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

Why wont this script work?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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)
0
I think it broke because of the update so im going to start from scratch agian and go from there. twizon69 15 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

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.

Ad

Answer this question