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

Why wont this script work?

I wrote this script into my GUI and when I test it solo it works great, Give's the weapons removes the GUI the whole nine yards. However when I start a server it dose not work. As you can see it is supposed to pop up a confirm and a decline TextButton, however neather show on a open server. Like i said before the work great in Solo Mode. Can anyone tell me why?

button = script.Parent
gui = script.Parent.Parent
hp = script.Parent.Medkit:Clone()
m4 = script.Parent.M4:Clone()
player = script.Parent.Parent.Parent.Parent
confirm = Instance.new("TextButton")
deny = Instance.new("TextButton")
choice = Instance.new("TextBox")

button.MouseButton1Click:connect(function()
	confirm.Parent = gui
	confirm.Position = UDim2.new(0, 500, 0, 150)
	confirm.Size = UDim2.new(0, 100, 0, 40)
	confirm.BackgroundColor3 = Color3.new(0, 170, 0)
	confirm.Text = "Affirmative"
	
	deny.Parent = gui
	deny.Position = UDim2.new(0, 500, 0, 200)
	deny.Size = UDim2.new(0, 100, 0, 40)
	deny.BackgroundColor3 = Color3.new(255, 0, 0)
	deny.Text = "Negative"
	
	choice.Parent = gui
	choice.Position = UDim2.new(0, 500, 0, 100)
	choice.Size = UDim2.new(0, 100, 0, 40)
	choice.BackgroundColor3 = Color3.new(0, 0, 0)
	choice.Text = "Confirm your choice"
	choice.TextColor3 = Color3.new(255, 255, 255)
	choice.Active = false
	choice.ClearTextOnFocus = false
end)

confirm.MouseButton1Click:connect(function()
	m4.Parent = player.Backpack
	hp.Parent = player.Backpack
	gui:remove()
end)

deny.MouseButton1Click:connect(function()
	confirm:remove()
	deny:remove()
	choice:remove()
end)

1 comment

0

I think it broke because of the update so im going to start from scratch agian and go from there.

1 answer

Ever tried debugging? Are you sure its meant to go: button.MouseButton1Click:connect(function() because thats a random variable in the middle of a string.

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