Hello, I have problem with script in text button, which is in Shop GUI. Here is script:
local price = 500
function Buy ()
local player = script.Parent.Parent.Parent.Parent.Parent
if player.leaderstats.Points.Value >= price then
player.leaderstats.Points.Value = player.leaderstats.Points.Value - price
player.Character.Humanoid.WalkSpeed = player.Character.Humanoid.WalkSpeed + 2
game.StarterGui.ShopGUI.ShopFrame["WalkSpeed +2"].Text = "Purchased!"
wait(1)
game.StarterGui.ShopGUI.ShopFrame["WalkSpeed +2"].Text = "WalkSpeed +2 ~500 Points~"
else
game.StarterGui.ShopGUI.ShopFrame["WalkSpeed +2"].Text = "Not Enought Points!"
wait(1)
game.StarterGui.ShopGUI.ShopFrame["WalkSpeed +2"].Text = "WalkSpeed +2 ~500 Points~"
end
end
script.Parent.MouseButton1Down:connect(Buy)
So he should show me "Purchased" when player buy "Walkspeed +2" and back to original text "WalkSpeed +2 500 Points, but don't work.
Without these lines, works perfectly :
game.StarterGui.ShopGUI.ShopFrame["WalkSpeed +2"].Text = "Purchased!"
wait(1)
game.StarterGui.ShopGUI.ShopFrame["WalkSpeed +2"].Text = "WalkSpeed +2 ~500 Points~"
else
game.StarterGui.ShopGUI.ShopFrame["WalkSpeed +2"].Text = "Not Enought Points!"
wait(1)
game.StarterGui.ShopGUI.ShopFrame["WalkSpeed +2"].Text = "WalkSpeed +2 ~500 Points~"
So can someone fix it?

3 comments
Does anything come out on OutPut?
Nope, script just not work with these lines.
player.PlayerGui not game.StarterGui