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

GUI tool giver?

Asked by 10 years ago

This script is having some issues. I am creating a OnClick GUI giver. The last part doesn't seem to work

gui = script.Parent
connector = Workspace.GUI
button = script.Parent.Giver
Tool = game.Lighting.BrownBessV1

print("Killer's Musket Giver V1 is active!")

function OnC()
    wait()
    print("Connecting...")
    if connector.Value == 1 then print("Value is 1!")
        gui.Visible = true
    else
        print("Value is 0!")
        gui.Visible = false
    end
end

function Give(Plr)
    Tool1 = Tool:clone()
    Tool1.Parent = Plr.Backpack
end

connector.Changed:connect(OnC)
button.MouseButton1Click:connect(Give)

That is the whole script. This part doesn't seem to work

function Give(Plr)
    Tool1 = Tool:clone()
    Tool1.Parent = Plr.Backpack
end

connector.Changed:connect(OnC)
button.MouseButton1Click:connect(Give)

I get this error:

15:29:48.174 - Players.Player1.PlayerGui.Move.Frame.Script:21: attempt to index local 'Plr' (a nil value) 15:29:48.175 - Stack Begin 15:29:48.176 - Script 'Players.Player1.PlayerGui.Move.Frame.Script', Line 21 15:29:48.176 - Stack End

1 answer

Log in to vote
0
Answered by
KAAK82 16
10 years ago

u didnt define the plr, I don't think it's connected with MouseButton1Click()

0
How do you define the plr? killerthedemon 14 — 10y
0
put this Script into a LocalScript and then at the beginning add; plr = game.Players.LocalPlayer KAAK82 16 — 10y
0
Explain more? killerthedemon 14 — 10y
0
put a LocalScript inside StarterGui and then inside it type; plr = game.Players.LocalPlayer KAAK82 16 — 10y
Ad

Answer this question