i haven't gotten that far myself with the viewmodel, when I learn how to do those things myself then I might make a tutorial, as I'm not the most advanced dev myself 😂😂
hi im a game dev and i do not suggest using tools, especially if your trying to make a good fps game. what i would do is make a singular local script in starterplayerscripts that handles the client. this will control the different keys that you want to press, like if you want to switch to your secondary, that is controlled. instead of using tools, it clones a viewmodel in replicatedstorage and brings it to the players camera. and instead of making a local script for each gun, just use modulescripts, its wayy easier. oh and if you want to add aiming, just add a part to your gun with a small size and put it at the position you want to aim, and then in the local script in starterplayerscripts, you can make it so that if you hold right click, it lerps the aimparts position to 0,0,0, putting the gun at the middle of the screen (you do have to rig the aimpart to the humanoidrootpart of the viewmodel tho)
Disable the startergui for the players backpack, it’s something like SetCoreGUI you can find it on studio documentation, I don’t know the exact function off the top of my head
I might be late, but what I did for the gun being visible on the server side of things, is that I added the M4A1 model (the gun model, not the whole viewmodel) into the tool and welded each part to the handle, and in the local script, in the 'tool.equipped' function, you go into the model and make each part inside it transparency to 1. That way, you will only the view model and other players will only see the tool's model. Also, don't forget to write the same code in the unequip function but set the transparency back to 0 so that when you drop the gun, it will not be invisible. Edit: I am using my own model and turned it into a union just to make setting the transparency of the gun only take 1 line of code. But it's optional.
script: local remote = script.Parent.BulletConnection remote.OnServerEvent:Connect(function(player, hitPart) if hitPart then if hitPart.Parent:FindFirstChild("Humanoid") or hitPart.Parent.Parent:FindFirstChild("Humanoid") then local humanoid = hitPart.Parent:FindFirstChild("Humanoid") or hitPart.Parent.Player:FindFirstChild("Humanoid") if hitPart.Name == "Head" or hitPart.Parent.Name == "Hair" then humanoid:TakeDamage(60) else humanoid:TakeDamage(30) end end end end) -------------------------------------------------------------------------------------- local script: local tool = script.Parent local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local Camera = workspace.Camera local RunService = game:GetService("RunService") local uis = game:GetService("UserInputService") local mouse = player:GetMouse() local remote = script.Parent.BulletConnection local held = false mouse.Button1Down:Connect(function() held = true end) mouse.Button1Up:Connect(function() held = false end) local ViewModel local equipped = false tool.Equipped:Connect(function() equipped = true game.ReplicatedStorage.ViewModel:Clone().Parent = Camera end) tool.Unequipped:Connect(function() equipped = false ViewModel = Camera.ViewModel ViewModel:Destroy() end) local swayCF = CFrame.new() RunService.RenderStepped:Connect(function() if player.Character.Humanoid.Health
Hey i have a problem where the script just removed the whole view model and does not work anymore with the actual gun script , i followed both guides and everything is correct but its just simply not working. In the local script where it says "if held then" it says there is a error in the held part
Hey, really nice video, i want to ask if you could explain how i could make it so theres limited ammo, like 30 bullets and then you ahve to reload, thanks.
i would like to add that in the server script, you could declare a damage table: local dmgTable = { ["Head"] = 60, ["Torso"] = 30, ["Left Arm"] = 15, ["Right Arm"] = 15, ["Left Leg"] = 15, ["Right Leg"] = 15 } and when the event is fired, you check if the hitPart.Name is in the table: remote.OnServerEvent:Connect(function(player, hitPart) if hitPart then if hitPart.Parent:FindFirstChild("Humanoid") or hitPart.Parent.Parent:FindFirstChild("Humanoid") then local humanoid = hitPart.Parent:FindFirstChild("Humanoid") or hitPart.Parent.Parent:FindFirstChild("Humanoid") if not dmgTable[hitPart.Name] then return end hum:TakeDamage(dmgTable[hitPart.Name]) end end end) this will make it so that hitting the body parts will do the damage that is declared in the table
Hey! i have a script for the damage table is you're still looking for it! Local Script: local remote = script.Parent.BulletConnection local damageValues = { Head = 100, Face = 100, Hair = 100, Torso = 40, ["Left Arm"] = 15, ["Right Arm"] = 15, ["Left Leg"] = 25, ["Right Leg"] = 25 } remote.OnServerEvent:Connect(function(player, hitPart) if hitPart then local humanoid
if hitPart.Parent:FindFirstChild("Humanoid") then humanoid = hitPart.Parent:FindFirstChild("Humanoid") elseif hitPart.Parent.Parent:FindFirstChild("Humanoid") then humanoid = hitPart.Parent.Parent:FindFirstChild("Humanoid") end
if humanoid then local damage = damageValues[hitPart.Name] or 15 -- Default damage is 15 if part is not specified humanoid:TakeDamage(damage) end end end) Just put it in your local script!
how would i go about adding multiple guns to the game? I tried just copying and pasting the same tool and viewmodel and renaming them and altering the code to fit the names but it doesnt work.
PLEASE PLEASE PLEASE make a video about:anims(Playing when something happens with gun), reloads, gui and different gun type(shotgun/semi auto). You got a extra sub (:
Alright, Mr. Stuffy Dev, the gun works and all, but I want other players to see the gun because it currently looks like the player is holding nothing. Also, could you please make another video showing how to add animations for reloading and shell ejection? Thank you!
Thats because its moving the viewmodel locally instead of on the server, as if it was on the server, then it would lag behind. I have never really thought of making the view model on the server end, but im sure there is probably another tutorial out there somewhere that shows you how to make one on the server end.
Hey Stuffy, I'm trying to make it so that the player holds a different gun when they take out the View Model and I'm wondering if there is a way to do that easily because I'm very very new to Roblox Studio, thank you
hello, i like your tutorial, but i have one issue, i got the working view model, but i cant shoot. its not playing sound and the dummy dont react on shots... i will leave my script that i wrote, please help. local script: local tool = script.Parent local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local Camera = workspace.Camera local RunService = game:GetService("RunService") local uis = game:GetService("UserInputService") local mouse = player:GetMouse() local remote = script.Parent.BullerConnection local held =false mouse.Button1Down:Connect(function() held = true end) mouse.Button1Up:Connect(function() held = false end) local ViewModel local equipped = false tool.Equipped:Connect(function() equipped = true game.ReplicatedStorage.ViewModel:Clone().Parent = Camera end) tool.Unequipped:Connect(function() equipped = false ViewModel = Camera.ViewModel ViewModel:Destroy() end) local swaySF = CFrame.new() RunService.RenderStepped:Connect(function() if player.Character.Humanoid.Health
This is an issue i have in all honesty. I'm pretty sure its because once you die it moves the model from your camera to somewhere else in the workspace, but it doesn't delete it outright.
I wonder if you could help me with my crosshair because its not showing so can you tell me where to edit the code on the script you made the crosshair pls
set the mouse icon to a crosshair image of your choosing. this is the code I have: local mouse = player:GetMouse() mouse.Icon = 'www.roblox.com/asset/?id=12829852445'
@@Aika33700 I told you how to do it but I don't see the text, I think UA-cam deleted it, basically he has a model where you just have to follow the instructions
you can't just say line 70 and expect me to know man 😭😭 Try using this model: create.roblox.com/store/asset/17150534927/Working-Gun-With-ViewModel-Made-by-StuffyDev
@@Aika33700 I already found the solution, just put as a filter in the toolbox the name of the user who made this video (the Roblox user) and give the model to say working in its name, and follow the instructions
why this dont work? local tool = script.Parent local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local Camera = workspace.Camera local RunService = game:GetService("RunService") local uis = game:GetService("UserInputService") local mouse = player:GetMouse() local remote = script.Parent.BullerConnection local held = false mouse.Button1Down:Connect(function() held = true end) mouse.Button1Up:Connect(function() held = false end) local ViewModel local equipped = false tool.Equipped:Connect(function() equipped = true game.ReplicatedStorage.ViewModel:Clone().Parent = Camera end) tool.Unequipped:Connect(function() equipped = false ViewModel = Camera.ViewModel ViewModel:Destroy() end) local swaySF = CFrame.new() RunService.RenderStepped:Connect(function() if player.Character.Humanoid.Health
it may be because in the line, "local result = workspace:Spherecast(startPos, size, aimDirection + range, raycastParams)" you put a plus symbol between the stuff in the parenthesis instead of the * symbol.
This video could have probably been shorter but I did it in one take so I'm surprised its not longer lmao
quick question: will there be any video on recoil and animations? like reloading.
i haven't gotten that far myself with the viewmodel, when I learn how to do those things myself then I might make a tutorial, as I'm not the most advanced dev myself 😂😂
@@StuffyDevdoes it works only with r15?
@@PLOR556 r6
@@StuffyDev thanks!
TYSM honestly you are so underated
hi im a game dev and i do not suggest using tools, especially if your trying to make a good fps game. what i would do is make a singular local script in starterplayerscripts that handles the client. this will control the different keys that you want to press, like if you want to switch to your secondary, that is controlled. instead of using tools, it clones a viewmodel in replicatedstorage and brings it to the players camera. and instead of making a local script for each gun, just use modulescripts, its wayy easier. oh and if you want to add aiming, just add a part to your gun with a small size and put it at the position you want to aim, and then in the local script in starterplayerscripts, you can make it so that if you hold right click, it lerps the aimparts position to 0,0,0, putting the gun at the middle of the screen (you do have to rig the aimpart to the humanoidrootpart of the viewmodel tho)
i aint doin allat
Quick question, is there a way to make the inventory bar invisible?
Disable the startergui for the players backpack, it’s something like SetCoreGUI you can find it on studio documentation, I don’t know the exact function off the top of my head
Thanks man!
@@StuffyDev yeah, i tried that, and it does go invisible, but you cant select the tool
i asked for it
thx
This is the best gun tutorial i found on youtube. You shoud totaly try experimenting with animations, reload functions and stuff, we need you lol.
Hey im begging that you show how to make a timer that resets when its over and an intermission with a gui
use gamestate and fireallclient
there is a template in studio that comes with a timer and intermission pre-built.
I swear you know what I’m working on. I get to the viewcast on my to do list and like 40 mins later you upload part 2 🎉
Tysm @Stuffy Dev I got it working and now its awesome!! it helped me start my first fps games!! tysm!!
Great tut, could you think about making an aim system and make the gun visible for other players?
I might be late, but what I did for the gun being visible on the server side of things, is that I added the M4A1 model (the gun model, not the whole viewmodel) into the tool and welded each part to the handle, and in the local script, in the 'tool.equipped' function, you go into the model and make each part inside it transparency to 1. That way, you will only the view model and other players will only see the tool's model. Also, don't forget to write the same code in the unequip function but set the transparency back to 0 so that when you drop the gun, it will not be invisible.
Edit: I am using my own model and turned it into a union just to make setting the transparency of the gun only take 1 line of code. But it's optional.
This was very thorough and very helpful! Thank you a lot!!
We waiting the next video !! im so excited !!
X2
script:
local remote = script.Parent.BulletConnection
remote.OnServerEvent:Connect(function(player, hitPart)
if hitPart then
if hitPart.Parent:FindFirstChild("Humanoid") or hitPart.Parent.Parent:FindFirstChild("Humanoid") then
local humanoid = hitPart.Parent:FindFirstChild("Humanoid") or hitPart.Parent.Player:FindFirstChild("Humanoid")
if hitPart.Name == "Head" or hitPart.Parent.Name == "Hair" then
humanoid:TakeDamage(60)
else
humanoid:TakeDamage(30)
end
end
end
end)
--------------------------------------------------------------------------------------
local script:
local tool = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Camera = workspace.Camera
local RunService = game:GetService("RunService")
local uis = game:GetService("UserInputService")
local mouse = player:GetMouse()
local remote = script.Parent.BulletConnection
local held = false
mouse.Button1Down:Connect(function()
held = true
end)
mouse.Button1Up:Connect(function()
held = false
end)
local ViewModel
local equipped = false
tool.Equipped:Connect(function()
equipped = true
game.ReplicatedStorage.ViewModel:Clone().Parent = Camera
end)
tool.Unequipped:Connect(function()
equipped = false
ViewModel = Camera.ViewModel
ViewModel:Destroy()
end)
local swayCF = CFrame.new()
RunService.RenderStepped:Connect(function()
if player.Character.Humanoid.Health
TYSM BRO
@@NightsHunter123 your welcome)
THANKS FOR SCRIPT
OMG THANKSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
uh bro, dont work for me :c
lol now we need another tutorial on how to add an Aim Down Sight System!
I added Debuggin and found out that it writes that it hit the Part but it just doesnt make any damage
Hey i have a problem where the script just removed the whole view model and does not work anymore with the actual gun script , i followed both guides and everything is correct but its just simply not working. In the local script where it says "if held then" it says there is a error in the held part
i did everything you did in the video but for some reason my gun dosent show when i pull it out
You should add animations to it like Firing, Aiming, and Reload. Also Crouching and lying down.
It didn't work for me. (without muzzle flash)
local tool = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Camera = workspace.Camera
local RunService = game:GetService("RunService")
local uis = game:GetService("UserInputService")
local mouse = player:GetMouse()
local ViewModel
local remote = script.Parent.BulletConnection
local equipped = false
local held = false
mouse.Button1Down:Connect(function()
held = true
end)
mouse.Button1Up:Connect(function()
held = false
end)
tool.Equipped:Connect(function()
script.Parent["Rugged Obsidian 9 Suppressor"].Transparency = 1
script.Parent.Mag.Transparency = 1
script.Parent.Barrel.Transparency = 1
script.Parent.Bolt.Transparency = 1
script.Parent.Handle.Transparency = 1
script.Parent.Bolt.Sight1.Transparency = 1
equipped = true
game.ReplicatedStorage.ViewModel:Clone().Parent = Camera
end)
tool.Unequipped:Connect(function()
script.Parent["Rugged Obsidian 9 Suppressor"].Transparency = 0
script.Parent.Mag.Transparency = 0
script.Parent.Barrel.Transparency = 0
script.Parent.Bolt.Transparency = 0
script.Parent.Handle.Transparency = 0
script.Parent.Bolt.Sight1.Transparency = 0
equipped = false
ViewModel = Camera.ViewModel
ViewModel:Destroy()
end)
local swayCF = CFrame.new()
RunService.RenderStepped:Connect(function()
if player.Character.Humanoid.Health
ALSO FOR ANYONE WONDERING WHY BODY SHOTS DONT WORK ITS BECUASE IT NEEDS TO BE "Torso" NOT BODY :(
very nice, managed to modify it by adding reload, and animations and a whole lot other stuff
Wait how? I need help
How did you make it play anims?
@@LoyalMealsRising made some anims, modified the script big time and there
@@Retro_qe0982 where did u modify the script? I need this like for real for real
@@Retro_qe0982 where did you put the anim script? Inside the tool or viewmodel
Hey, really nice video, i want to ask if you could explain how i could make it so theres limited ammo, like 30 bullets and then you ahve to reload, thanks.
i would like to add that in the server script, you could declare a damage table:
local dmgTable = {
["Head"] = 60,
["Torso"] = 30,
["Left Arm"] = 15,
["Right Arm"] = 15,
["Left Leg"] = 15,
["Right Leg"] = 15
}
and when the event is fired, you check if the hitPart.Name is in the table:
remote.OnServerEvent:Connect(function(player, hitPart)
if hitPart then
if hitPart.Parent:FindFirstChild("Humanoid") or hitPart.Parent.Parent:FindFirstChild("Humanoid") then
local humanoid = hitPart.Parent:FindFirstChild("Humanoid") or hitPart.Parent.Parent:FindFirstChild("Humanoid")
if not dmgTable[hitPart.Name] then return end
hum:TakeDamage(dmgTable[hitPart.Name])
end
end
end)
this will make it so that hitting the body parts will do the damage that is declared in the table
Hey! i have a script for the damage table is you're still looking for it!
Local Script:
local remote = script.Parent.BulletConnection
local damageValues = {
Head = 100,
Face = 100,
Hair = 100,
Torso = 40,
["Left Arm"] = 15,
["Right Arm"] = 15,
["Left Leg"] = 25,
["Right Leg"] = 25
}
remote.OnServerEvent:Connect(function(player, hitPart)
if hitPart then
local humanoid
if hitPart.Parent:FindFirstChild("Humanoid") then
humanoid = hitPart.Parent:FindFirstChild("Humanoid")
elseif hitPart.Parent.Parent:FindFirstChild("Humanoid") then
humanoid = hitPart.Parent.Parent:FindFirstChild("Humanoid")
end
if humanoid then
local damage = damageValues[hitPart.Name] or 15 -- Default damage is 15 if part is not specified
humanoid:TakeDamage(damage)
end
end
end)
Just put it in your local script!
@@symonnet5990 I just cant find out how to add aim down sights
quick question ive been typing out the script but every time it just wont show the model and ive checked 10 times everything is coded correctly
Can u make last tutorial for animating tool equipping and inspecting
can you teach how to animate the viewmodel?
I thought i finished 😭😭 I spent 1 hour on doing part 1 😭😭
2 hour here
how do you make animations ?
please make a tutorial for the bullet trail
Yo surely update the model you uploaded so that it includes the scripts from this video!
Anyways, thanks for the tutorial man
Please could we get recoil, animations and aiming down in the next vid (Very epic gamer vid tho keep up the epic work!)
Can you make a video on how to animate the gun? such as recoil and walking animations
hey, thanks for the tutorial, but can you make a tutorial on how to animate the viewmodel?
how would i go about adding multiple guns to the game? I tried just copying and pasting the same tool and viewmodel and renaming them and altering the code to fit the names but it doesnt work.
how do you shoot on mobile
Please make a part 2
The gun worked for me but its very hard to aim and usually does not hit the player
PLEASE PLEASE PLEASE make a video about:anims(Playing when something happens with gun), reloads, gui and different gun type(shotgun/semi auto). You got a extra sub (:
How do i add a aiming mechanic to this gun, ive been trying to add one and i keep failing
It shoots once then doesn't shoot again, any ideas why?
Alright, Mr. Stuffy Dev, the gun works and all, but I want other players to see the gun because it currently looks like the player is holding nothing. Also, could you please make another video showing how to add animations for reloading and shell ejection? Thank you!
Thats because its moving the viewmodel locally instead of on the server, as if it was on the server, then it would lag behind. I have never really thought of making the view model on the server end, but im sure there is probably another tutorial out there somewhere that shows you how to make one on the server end.
Chrised how do i make the viewmodel disappear when u die and it appear when u respawn plz
How do we add custom animations to the viewmodel?
Hey Stuffy, I'm trying to make it so that the player holds a different gun when they take out the View Model and I'm wondering if there is a way to do that easily because I'm very very new to Roblox Studio, thank you
At this point can u just copy and paste it on here I’ve been working on this for 2 and a half hours
hello, i like your tutorial, but i have one issue, i got the working view model, but i cant shoot. its not playing sound and the dummy dont react on shots...
i will leave my script that i wrote, please help.
local script:
local tool = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Camera = workspace.Camera
local RunService = game:GetService("RunService")
local uis = game:GetService("UserInputService")
local mouse = player:GetMouse()
local remote = script.Parent.BullerConnection
local held =false
mouse.Button1Down:Connect(function()
held = true
end)
mouse.Button1Up:Connect(function()
held = false
end)
local ViewModel
local equipped = false
tool.Equipped:Connect(function()
equipped = true
game.ReplicatedStorage.ViewModel:Clone().Parent = Camera
end)
tool.Unequipped:Connect(function()
equipped = false
ViewModel = Camera.ViewModel
ViewModel:Destroy()
end)
local swaySF = CFrame.new()
RunService.RenderStepped:Connect(function()
if player.Character.Humanoid.Health
Sorry for the late reply 😅
Try using this model: create.roblox.com/store/asset/17150534927/Working-Gun-With-ViewModel-Made-by-StuffyDev
@@StuffyDev Bro, thanks so much, i thought you wont respond at all!
im really happy thanks!!!
you just gained one subscriber!
Can you make a version of the viewmodel that can reload?
Can someone please help I did all of the coding right and it did not shoot at all. It didn't even play the sound
same
@@Noob-bznd hey man! i figured out what was wrong send me your code and i will see if anything is wrong with it!
@@symonnet5990 Here is my code
Hi, how to make it semi-automatic? I try to make the pistol using this tutorial, so i need know how to do that, pls help🙏
How to do so it's 1 person when you take the gun???
We need script for animations for the gun model
after you die, the arm appears again, how do i fix this
This is an issue i have in all honesty. I'm pretty sure its because once you die it moves the model from your camera to somewhere else in the workspace, but it doesn't delete it outright.
how do I give it a aim animation and other animations?
Please make a bullet tracer
my shooting dosent take damage pls help me
Just wanted to ask if you could make a car spawner, where the car spawns infront of you?
Just look in the tool box for that.
doesn't work, after i add both of the scripts i can't get the gun
Try using this model: create.roblox.com/store/asset/17150534927/Working-Gun-With-ViewModel-Made-by-StuffyDev
I wonder if you could help me with my crosshair because its not showing so can you tell me where to edit the code on the script you made the crosshair pls
set the mouse icon to a crosshair image of your choosing. this is the code I have:
local mouse = player:GetMouse()
mouse.Icon = 'www.roblox.com/asset/?id=12829852445'
@@StuffyDev it got taken down
@@gabelovescats its still up
How could i add BulletTracer??
Add Animations And Reloading data please
make a part 3 showing how to make gun inspect animaitons that will play with a keybind like F like CS:GO
use userinputservice and activate a function when the f key iss pressed
Can you make Aiming?
idk why but i have the song but no the damage
Add animations and reload data please
How to make a recoil? You can answer me in comments. Pls write the code and where to paste it
my gun wont shoot :(
Hello StuffyDev Please can you Show how add mobile buttons to the weapon 😢
bro, I did everything the tutorial said and it doesn't shoot.
same for me (again) go read my comment up there and tell me if maybe by chances you got the same problem as me.
@@Aika33700 I told you how to do it but I don't see the text, I think UA-cam deleted it, basically he has a model where you just have to follow the instructions
@@Aika33700If you don't know how to look for it, tell me and I will try to help you without UA-cam deleting my comments.
@@FantasminElOriginal Look listen to me i did everything his model and mine 2 times. this is not helping me
Dude my Gun Isnt Making Any Damage And Why Does Line 70 Have An Error?
you can't just say line 70 and expect me to know man 😭😭
Try using this model: create.roblox.com/store/asset/17150534927/Working-Gun-With-ViewModel-Made-by-StuffyDev
@@StuffyDevSORRY 😅 ty for the model
@@StuffyDevBtw could you make a Reload System?
In a next video maybe can you add tracers
Bro the script broke the gun and it doesnt appear no more
same
And animations .?
pls make a tutorail for a equip anim!!!!!
Why cant my gun shoot? at all someone help me
me too
@@FantasminElOriginal same this time ngl
same
@@Aika33700 I already found the solution, just put as a filter in the toolbox the name of the user who made this video (the Roblox user) and give the model to say working in its name, and follow the instructions
how do you add recoil?
How do I make it semi?
Make gun reload animation please
can you add animation Tutorial
BRUH I TEXTED THAT CODE 1.5 HOURS AND ITS DONT WORKED.
AFTER THAT I WATCH 2 MINUTES VIDEO, I ADDED ANOTHER SCRIPT AND ITS WORKED!!!!
bro can you give me the script you used please? I need it
bro can you add a gun reload please
can you do animations in next vid please
Not working bro i am working on it for like 6 hours and 6 hours for nothing, this tutorial is fake or what ???
SO SIGMA TUTORIAL ONG
how to aim?
per mirare?
pls bullet tracer
pls do tracers
14:39
doesnt work anymore bud
It works
7:21 Pls do a bullet tracer :| its been months i tried to make one but failed so pwese? 🥺🥺
mr beast?
Please
Add ANIMATIONS!!!!!!!!
atleast give us the script
Didn't work did everything point by point!
PleaseIl I beg you
thx for wasting 20 minutes of my life ._.
why this dont work?
local tool = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Camera = workspace.Camera
local RunService = game:GetService("RunService")
local uis = game:GetService("UserInputService")
local mouse = player:GetMouse()
local remote = script.Parent.BullerConnection
local held = false
mouse.Button1Down:Connect(function()
held = true
end)
mouse.Button1Up:Connect(function()
held = false
end)
local ViewModel
local equipped = false
tool.Equipped:Connect(function()
equipped = true
game.ReplicatedStorage.ViewModel:Clone().Parent = Camera
end)
tool.Unequipped:Connect(function()
equipped = false
ViewModel = Camera.ViewModel
ViewModel:Destroy()
end)
local swaySF = CFrame.new()
RunService.RenderStepped:Connect(function()
if player.Character.Humanoid.Health
it may be because in the line, "local result = workspace:Spherecast(startPos, size, aimDirection + range, raycastParams)" you put a plus symbol between the stuff in the parenthesis instead of the * symbol.