Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Do I make This Gun Reload By Clicking instead of hitting r?

Asked by 5 years ago

I can script but i for sure am not this good at it.. and my friend gave me this script but I think he copied it but he said he made it but anyway how do you make it to where it reloads from clicking instead of hitting R..

function onButton1Up(mouse)

automatichold = false

end



function onKeyDown(key, mouse)







if key:lower() == "r" then

if script.Parent.Ammo.Value ~= script.Parent.MaxAmmo.Value then

reloadsound = script.Parent.Handle:FindFirstChild("Reload")

if reloadsound then

reloadsound:Play()

end

enabled = false

script.Parent.VisibleB.Value = true

script.Parent.StringValue.Value = "Reloading"

repeat script.Parent.StringValue.Value = "Reloading" wait(0.3) script.Parent.Ammo.Value = script.Parent.Ammo.Value + 3 script.Parent.StringValue.Value = "Reloading" until script.Parent.Ammo.Value >= script.Parent.MaxAmmo.Value

script.Parent.Ammo.Value = script.Parent.MaxAmmo.Value

wait(0.2)

script.Parent.VisibleB.Value = false

enabled = true

end

end



if key:lower() == "m" then

if GunType == 0 then

GunType = 0

Recoil = 3

else

GunType = 1

Recoil = 3

end

end



end

function onEquipped(mouse)

equipped = true



if mouse == nil then

print("Mouse not found")

return

end

mouse.Icon = "http://www.roblox.com/asset/?id=52812029"

mouse.Button1Down:connect(function() onButton1Down(mouse) end)

mouse.Button1Up:connect(function() onButton1Up(mouse) end)

mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)



end



function onUnequipped(mouse)

equipped = false

automatichold = false





end



script.Parent.Equipped:connect(onEquipped)

script.Parent.Unequipped:connect(onUnequipped)

while true do wait()

if script.Parent.Ammo.Value == 0 then

script.Parent.VisibleB.Value = true

script.Parent.StringValue.Value = "Reload"

end

if GunType == 1 then

script.Parent.ModeText.Value = "Auto"

else

script.Parent.ModeText.Value = "Semi"

end

end
0
Just check if it dosent have ammo and you click Fad99 286 — 5y
0
Ik that but can you provide the script and how to correct the script in the answer section please and thank you so much ChefDevRBLX 90 — 5y
0
Hm ChefDevRBLX 90 — 5y
0
did you just use it as a free model? Cus if u didn't, you would be able to figure that out LennyPlayzYT 269 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Assuming you are using the :GetMouse() you can use the event .Button1Down(). This fires when the player clicks down Left Mouse Button. Similarly with .Button2Down() when the player clicks down Right Mouse Button.

0
As said I suck so could you possibly like add it into the script I gave? And help more thanks :) ChefDevRBLX 90 — 5y
0
This isn't a requests site. We just give you the answers. BenjySmb 16 — 5y
Ad

Answer this question