Hi I have been scripting this with some help and when I went to play with my friends the text button didn't work for anyone. It only worked in the test server with one player. Can you help?
plr = game.Players.LocalPlayer price = 550 debounce = false script.Parent.MouseButton1Click:connect(function() if debounce then return end local v = plr.leaderstats.Credits debounce = true if v.Value >= price then plr.Backpack.ClassicSword.Configurations.LungeDamage.Value = 50 v.Value = v.Value - price script.Parent.Parent.Buy.Visible = true wait(0.2) for i = 0.1,1,0.1 do wait(0.1) script.Parent.Parent.Buy.TextTransparency = i end script.Parent.Active = false script.Parent.Visible = false script.Parent.Parent.upgrade2.Active = true script.Parent.Parent.upgrade2.Visible = true script.Parent.Parent.error.Position = UDim2.new(0, 200, 0, 100) script.Parent.Parent.Buy.Position = UDim2.new(0, 200, 0, 100) print('You bought the item!') else print ('Cant buy item!') script.Parent.Parent.error.Visible = true for i = 0.1,1,0.1 do -- from 0.1 to 1 with 0.1 increments wait(0.1) script.Parent.Parent.error.TextTransparency = i end end debounce = false end)
--Instead use server sided PlayerAdded event price = 550 debounce = false game.Players.PlayerAdded:connect(function(plr)--This event will handle multiple players in your game if you wanna stick to local use the ChildAdded event. script.Parent.MouseButton1Click:connect(function() if debounce then return end local v = plr.leaderstats.Credits debounce = true if v.Value >= price then plr.Backpack.ClassicSword.Configurations.LungeDamage.Value = 50 v.Value = v.Value - price script.Parent.Parent.Buy.Visible = true wait(0.2) for i = 0.1,1,0.1 do wait(0.1) script.Parent.Parent.Buy.TextTransparency = i end script.Parent.Active = false script.Parent.Visible = false script.Parent.Parent.upgrade2.Active = true script.Parent.Parent.upgrade2.Visible = true script.Parent.Parent.error.Position = UDim2.new(0, 200, 0, 100) script.Parent.Parent.Buy.Position = UDim2.new(0, 200, 0, 100) print('You bought the item!') else print ('Cant buy item!') script.Parent.Parent.error.Visible = true for i = 0.1,1,0.1 do -- from 0.1 to 1 with 0.1 increments wait(0.1) script.Parent.Parent.error.TextTransparency = i end end debounce = false end) end)
If this helped which I hope it did be sure to upvote or accept.