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

Surface Gui Shop?

Can anyone tell me what wrong with this script.

Player=script.Parent.Parent.Parent.Parent.Parent
script.Parent.Text=tostring(script.Parent.ItemName.Value)..": "..tonumber(script.Parent.Cost.Value).." "..tostring(script.Parent.Currency.Value)
script.Parent.MouseButtom1Click:connect(function()
if Player:findFirstChild("leaderstats") then
if Player.leaderstats[script.Parent.Currency.Value].Value>=tonumber(script.Parent.Cost.Value) then
Player.leaderstats[script.Parent.Currency.Value].Value=Player.leaderstats[script.Parent.Currency.Value].Value-tonumber(script.Parent.Cost.Value)
game.Lighting[script.Parent.ItemName.Value]:Clone().Parent=Player.Backpack
game.Lighting[script.Parent.ItemName.Value]:Clone().Parent=Player.StarterGear
end
end
end)

The script is inside a Textbuttom which is inside a frame which is inside a SurfaceGui

2 answers

✓ Accepted answer

You misspelled MouseButton1Click() in line 3

Look at your Script Output. Is it generating any errors? If so, then what are they?

2 comments

0

It came up with a error saying " MouseButtom1Click is not a valid member of TextButton"

0

Can anyone help me fix this problem?

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