Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

GUI tool giver?

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

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

4 comments

0

How do you define the plr?

0

put this Script into a LocalScript and then at the beginning add; plr = game.Players.LocalPlayer

0

Explain more?

0

put a LocalScript inside StarterGui and then inside it type; plr = game.Players.LocalPlayer

This discussion is preserved as it was. New answers, comments, and votes are closed.