For the local script: local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local cooldown = false script.Parent.Activated:Connect(function() if cooldown == false then script.Parent.Fire:Play() script.Parent.MuzzleFlash.MuzzleEffect.Enabled = true wait(0.1) script.Parent.MuzzleFlash.MuzzleEffect.Enabled = false local Target = Mouse.Target
if Target.Parent:FindFirstChild("Humanoid") then
game.ReplicatedStorage.Fire:FireServer(Target.Parent) end cooldown = true wait(0.5) cooldown = false end end) No Problem =)
This is low key the best gun tutorial yet. You actually show me what to do unlike just saying it like most everyone else. Plus, you actually explain things and include how to make muzzles flashes and firing sound effects. When I went down to drop a like I was so sad you only had 25 likes. You definitely deserve more attention! Thanks so much, your vid was great!❤❤❤
if your lazy and cant type here is the script local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local cooldown = false script.Parent.Activated:Connect(function() if cooldown == false then script.Parent.Fire:Play() script.Parent.MuzzleFlash.MuzzleEffect.Enabled = true wait(0.1) script.Parent.MuzzleFlash.MuzzleEffect.Enabled = false local Target = Mouse.Target if Target.Parent:FindFirstChild("Humanoid") then -- Fire Server game.ReplicatedStorage.Fire:FireServer(Target.Parent) end cooldown = true wait(0.5) cooldown = false end end)
This is Lowkey one of the best tutorial videos out there. But I have one question tho.. Where do you learn to script? anything other than that its awesome and like and sub earned!
Bro I love how easy this is yet it works really well, I see other tutorials where theirs ends up almost similar to this one but with like a hundred more lines! You've earned a well sub :D
found a bug If you shoot in the sky it will give an error I think it's because the target (the sky, which isn't considered an instance) doesn't have a parent but still great tutorial error message: *Players.Player.Backpack.Gun.LocalScript:12: Attempt to index nil with 'Parent'*
tysm I was making a gun script for my game but had errors, but then I realized because of this that I didn't need == for the if then statement. I completely forgot the fact that every if then statement doesn't need something to be equal to. Thanks!
For Local Script: local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local cooldown = false script.Parent.Activated:Connect(function() if cooldown == false then script.Parent.Fire:Play() script.Parent.MuzzleFlash.MuzzleEffect.Enabled = true wait(0.1) script.Parent.MuzzleFlash.MuzzleEffect.Enabled = false local Target = Mouse.Target
if Target.Parent:FindFirstChild("Humanoid") then
game.ReplicatedStorage.Fire:FireServer(Target.Parent) end cooldown = true wait(0.5) cooldown = false end end) For script: game.ReplicatedStorage.Fire.OnServerEvent:Connect(function(player, Target) Target.Humanoid.Health -= 10
script won't work, says that apparently muzzleflash isn't a valid member. this is the script local Player = game.Players.LocalPlayer local Mouse = Player: GetMouse() local cooldown = false
script.Parent.Activated:Connect(function() if cooldown == false then script.Parent.Fire:Play() script.MuzzleFlash.MuzzleEfect.Enabled = true wait(0.1) script.Parent.MuzzleFlash.MuzzleEffect.Enabled = false local Target = Mouse.Target
if Target.Parent:FindFirstChild("Humanoid1") then
game.ReplicatedStorage.Fire:FireServer(Target.Parent) end cooldown = true wait(0.1) cooldown = false end end)
Instructions Unclear: Spent 99+ hours making a custom muzzle flash model, only for it to not weld, spent 99+ more hours trying to get it to weld, doesnt work, realize that i was trying to weld the group not the individual object, finally get it to weld, then decided i had enough for the day.
i have one problem. whenever i use the gun it works only on certain parts of the dummy, i believe its because of the accessories but i have not found a way to filter it
it can only damage the player once and not unlimited times, like for example, i can shoot it multiple times but on the second shot, there would be no damage and so on
I have a problem where me character is only holding the handle part and not the other parts of thew gun, I'm trying to make an AR so that might be the case, if not pls tell me
Local script: local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local cooldown = false script.Parent.Activated:Connect(function() if cooldown == false then script.Parent.Fire:Play() script.Parent.MuzzleFlash.MuzzleEffect.Enabled = true wait(0.1) script.Parent.MuzzleFlash.MuzzleEffect.Enabled = false local Target = Mouse.Target
if Target.Parent:FindFirstChild("Humanoid") then
game.ReplicatedStorage.Fire:FireServer(Target.Parent) end cooldown = true wait(0.5) cooldown = false end end) Normal script: game.ReplicatedStorage.Fire.OnServerEvent:Connect(funtion(player, Target)) Target.Humanoanoid.Heath -= 10 end) credits to: @Ice_runners and @Raidenlee1204 But I just put the 2 together to make it easier :)
The cooldown works when im shooting at an object or at the dummy/a person, but when i shoot in the air and not making contact with anything I can spam the gun. Im most likely not going to still use this script but a tip for that would be appreciated
@@devmelonroblox Is there anything wrong with these scripts though? Here is the Local Script: local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local debounce = false script.Parent.Activated:Connect(function() if debounce == false then script.Parent.Fire:Play() script.Parent.MuzzleFlash.MuzzleEffect.Enabled = true wait(0.1) script.Parent.MuzzleFlash.MuzzleEffect.Enabled = false local Target = Mouse.Target if Target.Parent:FindFirstChild("Humanoid") then -- Fire Server game.ReplicatedStorage.Fire:FireServer(Target.Parent) debounce = true wait (1) cooldown = false
end) And the Script: game.ReplicatedStorage.Fire.OnServerEvent:Connect(function(player, Target) Target.Humanoid.Health -= 10
My muzzle doesn't work my flash isn't working and I cant deal damage to dummy's even though I did everything on point I don't understand bro by the way you earned yourself a follower
Make a gui and a variable. whenever the gun is fired the variable will decrease by 1. Set the gui to that variable (that variable has to be an intvalue). Then if it is 0 play your reload animation.
I was testing it against some zombie models and it didnt work is there something in my cod emessing with it becuase I was working it with the avatar rig and it did it damnage over time
Doesn't work anymore unfortunately Edit: the error received in the Output is "LocalPlayer is not a valid member of Players "Players" Edit 2: I identified the mistake, the error is that I accidentally made a letter in caps, thank you for the tutorial
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local cooldown = false script.Parent.Activated:Connect(function() if not cooldown then script.Parent.Fire:Play() script.Parent.MuzzleFlash.MuzzleEffect.Enabled = true wait(0.1) script.Parent.MuzzleFlash.MuzzleEffect.Enabled = false local Target = Mouse.Target if Target.Parent:FindFirstChild("Humanoid") or Target.Parent:FindFirstChild("Head") or Target.Parent:FindFirstChild("Left Arm") or Target.Parent:FindFirstChild("Right Arm") or Target.Parent:FindFirstChild("Left Leg") or Target.Parent:FindFirstChild("Right Leg") then -- Fire Server game.ReplicatedStorage.Fire:FireServer(Target.Parent) else print() end end end) The script you gave does not damage the player if shot in the limbs. Use this script so that if you shoot the limbs, it will also damage.
Can someone please help me, when ever I play or try to shoot the gun and the output says Fire is not a valid member of Tool "Workspace.(My username).gun pleaseee help
Yeah thats a big problem with non-raycast guns You can also shoot through walls i would suggest searching up "How to make a raycast gun" they are gonna be a bit complicated but they'll be better than this kind
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local cooldown = false script.Parent.Activated:Connect(function() if cooldown == false then script.Parent.Fire:Play() script.Parent.MuzzleFlash.MuzzleEffect.Enabled = true wait(0.1) script.Parent.MuzzleFlash.MuzzleEffect.Enabled = false local Target = Mouse.Target if Target.Parent:FindFirstChild("Humanoid") then -- Fire Server game.ReplicatedStorage.Fire:FireServer(Target.Parent) end cooldown = true wait(0.5) cooldown = false end end)
Thank you for watching if you enjoyed please make sure to subscribe and like!
I don’t see a link😡🤬
@@BossWZ_official lazy kids belike:
@@RubenTheGamerOfficial shut the hell up. You can’t even be talking, you repost
@@BossWZ_officialblud look on description
I just have a question I made the tool un anchored it and stuff but it’s not becoming a tool in my inventory and the too, grip editor ain’t working
For the local script:
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local cooldown = false
script.Parent.Activated:Connect(function()
if cooldown == false then
script.Parent.Fire:Play()
script.Parent.MuzzleFlash.MuzzleEffect.Enabled = true
wait(0.1)
script.Parent.MuzzleFlash.MuzzleEffect.Enabled = false
local Target = Mouse.Target
if Target.Parent:FindFirstChild("Humanoid") then
game.ReplicatedStorage.Fire:FireServer(Target.Parent)
end
cooldown = true
wait(0.5)
cooldown = false
end
end)
No Problem =)
the only true gigachads are people who do this lmao
thanks W mans
your a legend
What about the script?
and for the normal script:
game.ReplicatedStorage.Fire.OnServerEvent:Connect(funtion(player, Target))
Target.Humanoanoid.Heath -= 10
end)
This is low key the best gun tutorial yet. You actually show me what to do unlike just saying it like most everyone else. Plus, you actually explain things and include how to make muzzles flashes and firing sound effects. When I went down to drop a like I was so sad you only had 25 likes. You definitely deserve more attention! Thanks so much, your vid was great!❤❤❤
Thanks! I’m glad you enjoyed Im always here to help!
One question though, how do you get the hand model part? Where you adjust how it fits in your hands?
It’s a plug-in, it’s called tool grip editor but it’s for robux. You can find some alternatives for free
Thanks!
ik
if your lazy and cant type here is the script local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local cooldown = false
script.Parent.Activated:Connect(function()
if cooldown == false then
script.Parent.Fire:Play()
script.Parent.MuzzleFlash.MuzzleEffect.Enabled = true
wait(0.1)
script.Parent.MuzzleFlash.MuzzleEffect.Enabled = false
local Target = Mouse.Target
if Target.Parent:FindFirstChild("Humanoid") then
-- Fire Server
game.ReplicatedStorage.Fire:FireServer(Target.Parent)
end
cooldown = true
wait(0.5)
cooldown = false
end
end)
I have been working on a rifle for like three days. Thank you for this. Simple and right to the point.
You are a very underrated dev you deserve more attention
Thanks! I will post more soon! I was on vacation
Your videos are good I think it just has to be easier to see
And also thanks for helping me make my own Roblox game
Great vid and you explained everything so now you got a new subscriber
Awesome, thank you!
Thank you so much! I dont think I've seen such an effective tutorial work so well and be so simple!
tip: make the muzzle effect in the muzzle flash disabled so that when you equip it wont show
This is Lowkey one of the best tutorial videos out there. But I have one question tho.. Where do you learn to script? anything other than that its awesome and like and sub earned!
I learned from RUclips tutorials ahahaha
Thanks for helping me make my Roblox game you are the best
Thanks for the tutorial it helped me a lot in making an efficient gun for my game, but where did the two other parts go?
I deleted the
Because they had too many bugs, I’ll be releasing the next part soon with all bugs fixed
I like these tutorials, quick and easy.
Thanks!
The tool grip editor costs a hundred robux
I bought one for free
there's a lite version
Where bro
Buy the free version by Egomoose
Now its free rn quickly go get it !
Thank you bro 🙏
I know legit NOTHING about scripting, thank you for getting straight to the point.
Thank you! This has to be the best gun tutorial.
it dont work no more lol
Bro I love how easy this is yet it works really well, I see other tutorials where theirs ends up almost similar to this one but with like a hundred more lines! You've earned a well sub :D
Thank you! Im happy you enjoyed!
found a bug
If you shoot in the sky it will give an error
I think it's because the target (the sky, which isn't considered an instance) doesn't have a parent
but still great tutorial
error message:
*Players.Player.Backpack.Gun.LocalScript:12: Attempt to index nil with 'Parent'*
I’ll fix it in the next tutorial!
@@devmelonroblox nice to hear
btw can you do tutorial about the more complicated "raycast-operated" guns too?
thxsm it will help me with my first person shooter game called trenches
Nice! Im glad I could help!
How do I put a bullet system on this? where can the player reload ammo?
I will make a part two soon on this
btw make sure the muzzleflash in unanchored
OMG TYSM! when i equiped the gun, i teleport somewhere else. but after i kept it unanchored, it works perfect!!
@@codmboy5 the part 2 is broken tho
@@blablawhite6303 what part 2?
bro i did every step and it didnt work. ive been trying for months to get a good gun system and i cant. can anyone help me?
Do you know how to Script?
@@Ontubespicy7 nah, thats why we are on a "how to vid"
@@poland_lover69 probably
tysm I was making a gun script for my game but had errors, but then I realized because of this that I didn't need == for the if then statement. I completely forgot the fact that every if then statement doesn't need something to be equal to. Thanks!
Thanks For Help It Realy Help Thanks a lot!
You just saved my day :D
Thank You Dearly, I Am Making A Gunfight Arena Game.
For Local Script: local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local cooldown = false
script.Parent.Activated:Connect(function()
if cooldown == false then
script.Parent.Fire:Play()
script.Parent.MuzzleFlash.MuzzleEffect.Enabled = true
wait(0.1)
script.Parent.MuzzleFlash.MuzzleEffect.Enabled = false
local Target = Mouse.Target
if Target.Parent:FindFirstChild("Humanoid") then
game.ReplicatedStorage.Fire:FireServer(Target.Parent)
end
cooldown = true
wait(0.5)
cooldown = false
end
end) For script: game.ReplicatedStorage.Fire.OnServerEvent:Connect(function(player, Target)
Target.Humanoid.Health -= 10
w heart
Excuse me if i want to add my own animations what do I do?
I might make a tutorial on this when i have time
Thankis
script won't work, says that apparently muzzleflash isn't a valid member. this is the script
local Player = game.Players.LocalPlayer
local Mouse = Player: GetMouse()
local cooldown = false
script.Parent.Activated:Connect(function()
if cooldown == false then
script.Parent.Fire:Play()
script.MuzzleFlash.MuzzleEfect.Enabled = true
wait(0.1)
script.Parent.MuzzleFlash.MuzzleEffect.Enabled = false
local Target = Mouse.Target
if Target.Parent:FindFirstChild("Humanoid1") then
game.ReplicatedStorage.Fire:FireServer(Target.Parent)
end
cooldown = true
wait(0.1)
cooldown = false
end
end)
Thanks for the tutorial man, earned a sub. Just one question, how would I add reload/recoil anims? Would I put it in where the firing functions are?
You can just play animations I think I’ll add this in part 3
My muzzle flash is on my gun is that why it’s not working?
Wdym not working
Instructions Unclear: Spent 99+ hours making a custom muzzle flash model, only for it to not weld, spent 99+ more hours trying to get it to weld, doesnt work, realize that i was trying to weld the group not the individual object, finally get it to weld, then decided i had enough for the day.
TY
The handle thing isn't showing up when i get the gun i need some help please.
me too
Best damn gun tutorial ive ever seen, no raycasting here!
how do I make it so the muzzle flash is visible to others??
I will make a new video soon with more details and I will add this as well!
@@devmelonroblox Thank you!
i have one problem. whenever i use the gun it works only on certain parts of the dummy, i believe its because of the accessories but i have not found a way to filter it
i have a problem with the damage script where the more people per server the more damage?
It doesnt Work.Every time i equip the gun i just go into to the floor
oh try putting it above the floor it's because the gun is attached to the floor lol
hope this helps :P
Make it so its not anchored
it can only damage the player once and not unlimited times, like for example, i can shoot it multiple times but on the second shot, there would be no damage and so on
How do you make this automatic for something like an AK47.
Just get rid of the cool down
nvm but it just makes the gun faster
I've done nothing different yet it simply doesn't work
please help
Do you get errors?
so i have a problem every time i equip the gun i get teleported to where i edited the tool grip any tips on how to make it be like in the video?
make the muzzleflash unanchored
@@codmboy5 thx
I have a problem where me character is only holding the handle part and not the other parts of thew gun, I'm trying to make an AR so that might be the case, if not pls tell me
Local script:
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local cooldown = false
script.Parent.Activated:Connect(function()
if cooldown == false then
script.Parent.Fire:Play()
script.Parent.MuzzleFlash.MuzzleEffect.Enabled = true
wait(0.1)
script.Parent.MuzzleFlash.MuzzleEffect.Enabled = false
local Target = Mouse.Target
if Target.Parent:FindFirstChild("Humanoid") then
game.ReplicatedStorage.Fire:FireServer(Target.Parent)
end
cooldown = true
wait(0.5)
cooldown = false
end
end)
Normal script:
game.ReplicatedStorage.Fire.OnServerEvent:Connect(funtion(player, Target))
Target.Humanoanoid.Heath -= 10
end)
credits to: @Ice_runners and @Raidenlee1204
But I just put the 2 together to make it easier :)
The cooldown works when im shooting at an object or at the dummy/a person, but when i shoot in the air and not making contact with anything I can spam the gun. Im most likely not going to still use this script but a tip for that would be appreciated
can you make an tutorial on how to make an a Assault rifle
A very good tutorial, but this system can be hacked easily by a line of code. Is their any way to prevent that from happening ?
my gun is not in my hand is it because I don't have the tool grip editor?
Most likely, it can also be becuase its anchored
Hey bro does this tutorial work on Assault rifle's?
yeah but about tool grip , how can you put the other hand under the other grip ?
the toolbox part at the very beginning threw me off, I do not have those items in my inventory :(
What do you mean?
And also I like and subscribe
the script (not localscript) doesnt work it says "attempt to index nil with "Humanoid"." How do i fix it
where do you get the handle?
The model is from the toolbox, you can just use a part but make sure to call it handle otherwise the tool will not work
I wasted a lot of time I pulled out the gun and it didnt show up and it was gone from my inventory
Make sure to unanchor it!
@@devmelonroblox Ok thanks!
@@devmelonroblox It still doesn't work
@@devmelonroblox Is there anything wrong with these scripts though?
Here is the Local Script:
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local debounce = false
script.Parent.Activated:Connect(function()
if debounce == false then
script.Parent.Fire:Play()
script.Parent.MuzzleFlash.MuzzleEffect.Enabled = true
wait(0.1)
script.Parent.MuzzleFlash.MuzzleEffect.Enabled = false
local Target = Mouse.Target
if Target.Parent:FindFirstChild("Humanoid") then
-- Fire Server
game.ReplicatedStorage.Fire:FireServer(Target.Parent)
debounce = true
wait (1)
cooldown = false
end)
And the Script:
game.ReplicatedStorage.Fire.OnServerEvent:Connect(function(player, Target)
Target.Humanoid.Health -= 10
Is the tool grip a necessity?
no you can rotate the tool and move the handle away from it a bit
Nice! works
My muzzle doesn't work my flash isn't working and I cant deal damage to dummy's even though I did everything on point I don't understand bro by the way you earned yourself a follower
Join the discord I could help you out!
Is there any way to make it run out of ammo out of 30 rounds and play a reload animation, then be able to shoot again?
Make a gui and a variable. whenever the gun is fired the variable will decrease by 1. Set the gui to that variable (that variable has to be an intvalue). Then if it is 0 play your reload animation.
I was testing it against some zombie models and it didnt work is there something in my cod emessing with it becuase I was working it with the avatar rig and it did it damnage over time
Doesn't work anymore unfortunately
Edit: the error received in the Output is "LocalPlayer is not a valid member of Players "Players"
Edit 2: I identified the mistake, the error is that I accidentally made a letter in caps, thank you for the tutorial
Doesn't work.
Is the cool down needed
is there any way you can add animations to it?
The gun script didn’t work at all :(
I don't entirely understand how to assemble the tool grip plugin
Add reloading script too
It doesn't work for me in public servers. Does anybody have a solution?
When I use it my character teleports into the sky! can ya help with that? (I use r6 in my game)
Unanchor it i think
im using a gui that clones guns but when i try to shoot i take no damage please help
Apparently my code is wrong and don’t know how to fix it, line 7 for me apparently didn’t close even tho I thought I did
It says muzzle effect is not a valid number help
for some reason enimes only take damage when their right infront of me it has no range for some reason?
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local cooldown = false
script.Parent.Activated:Connect(function()
if not cooldown then
script.Parent.Fire:Play()
script.Parent.MuzzleFlash.MuzzleEffect.Enabled = true
wait(0.1)
script.Parent.MuzzleFlash.MuzzleEffect.Enabled = false
local Target = Mouse.Target
if Target.Parent:FindFirstChild("Humanoid") or
Target.Parent:FindFirstChild("Head") or
Target.Parent:FindFirstChild("Left Arm") or
Target.Parent:FindFirstChild("Right Arm") or
Target.Parent:FindFirstChild("Left Leg") or
Target.Parent:FindFirstChild("Right Leg") then
-- Fire Server
game.ReplicatedStorage.Fire:FireServer(Target.Parent)
else
print()
end
end
end)
The script you gave does not damage the player if shot in the limbs.
Use this script so that if you shoot the limbs, it will also damage.
Sad, i cant make the gun bc the tool grip editor costs robux :(
I think there are some free alternatives
You can also find a video how to do it without a plugin it might be a bit harder but I might do a video on it
@@devmelonroblox please make a video on it
How do i make multiple guns they stop working when I make more
ok i did that but my gun keeps flashing and i cant shoot
This was a very good tutorial but my gun can't kill stuff
Join the discord I’ll try to help you out!
@@devmelonroblox mine dosent have range
What do you mean? I’ll be posting a part 4 with bug fixes soon
Can you please link the model in the description?
when i buy a tool grip editor,its costed 100 robux but i have 0 robux
One Downside Is you Need to Pay for the grip editor.
for real.
Now its FREE
When i equip the gun it teleports me into a certain spot in the ground and it also doesnt fire and there is no muzzle flash
Make sure to unanchor it
either dont anchor a part or put in the middle of the air
how can i make a beam apears simulating the shot direction
It's working on one gun I have but I just made a flintlock pistol and it won't work for a second one.
I will fix it on the second part
Why did you delete part two and three?
For some reason my gun doesn't damage the dummy, can you help me out?
DO oyu have any errors?
pls tell me how to download tool grip editor
You have to pay for it sadly
@@devmelonroblox There is a Rojo version that is free that i use, not as good as the paid one
@@mutantdog can u link it or something
The weld constraint isnt working
i made my own gun which part should be named handle?
The part that you hold
it doesnt work for r6?
does it only work in r15 im gettin pissed off
Are you still planing on continueing this series?
Yes of course I’m just on vacation right now
@@devmelonroblox oh okay
Hey nice video but how would you make multiple guns in one game?
I’ll make a part 2 fixing this!
Can someone please help me, when ever I play or try to shoot the gun and the output says Fire is not a valid member of Tool "Workspace.(My username).gun pleaseee help
how to get the tool grip editor?
It costs 100 robux, its the descriptiono
The only problem is that exploiters can make a kill all script by just using the fire event on everyone repeatedly
Yeah thats a big problem with non-raycast guns You can also shoot through walls i would suggest searching up "How to make a raycast gun" they are gonna be a bit complicated but they'll be better than this kind
That’s true I only made a basic gun but I might actually add raycast in second part
if you could put your scripts in the pinned comment rthat would help i think i messed it up
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local cooldown = false
script.Parent.Activated:Connect(function()
if cooldown == false then
script.Parent.Fire:Play()
script.Parent.MuzzleFlash.MuzzleEffect.Enabled = true
wait(0.1)
script.Parent.MuzzleFlash.MuzzleEffect.Enabled = false
local Target = Mouse.Target
if Target.Parent:FindFirstChild("Humanoid") then
-- Fire Server
game.ReplicatedStorage.Fire:FireServer(Target.Parent)
end
cooldown = true
wait(0.5)
cooldown = false
end
end)
@@MajorCreepers tysm
Spent an hour doing this and didn't work
how do u delete the scripts?
select the script and press del or right click and find the delete button