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

GUI Button does nothing. No error or anything just nothing happens?

Asked by 8 years ago

Title pretty much says it. Had an old code that was having an error I could not for the life of me figure out why it was occurring there was just no reason it should have been happening. So I made code a little more inefficient but should work because I have done it before. Well now the button does nothing. I tried adding prints throughout to see if it stops somewhere but nothing like it does nothing at all and I can't figure out why. Here's the code:

01local but = script.Parent
02local gun = but.Parent.Weapon.Value
03local wep = game.ReplicatedStorage.Weps
04local player = game.Players.LocalPlayer
05local pack = player.Backpack
06 
07but.MouseButton1Click:connect(function()
08    if gun.Value == "MP5K" then
09        local clone1 = wep.MP5K:clone()
10        clone1.Parent = pack
11    elseif gun == "M4" then
12        local clone1 = wep.M4:clone()
13        clone1.Parent = pack
14    elseif gun == "Glock 17" then
15        local clone1 = wep.Glock17:clone()
View all 21 lines...

Like is this normal to just have a button do absolutely nothing? This is a local script in the button.

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

Don't use MouseButton1Click, use MouseButton1Down. That works best.

Ad

Answer this question