local player = game.Players.LocalPlayer local currency = player:WaitForChild('leaderstats').Coins local amount = 200 local tool = game.ReplicatedStorage:WaitForChild('LinkedSword') local indextext = script.Parent.Text script.Parent.MouseButton1Click:connect(function() if currency.Value >= amount and not player.Backpack:FindFirstChild('LinkedSword') or player.Character:FindFirstChild('LinkedSword') then currency.Value = currency.Value - amount local newtool = tool:Clone() newtool.Parent = player.Backpack script.Parent.TextColor3 = Color3.fromRGB(11, 199, 4) script.Parent.Text = 'Purchase succesful!' wait(2) script.Parent.TextColor3 = Color3.fromRGB(27, 42, 53) script.Parent.Text = indextext else script.Parent.TextColor3 = Color3.fromRGB(255, 0, 0) script.Parent.Text = 'Purchase failed, you either already have this item or do not have enough coins' wait(2) script.Parent.TextColor3 = Color3.fromRGB(27, 42, 53) script.Parent.Text = indextext end end) script.Parent.MouseEnter:connect(function() script.Parent.Parent.Parent.ProductImage.Image = 'rbxassetid://'..script.ImageValue.Value script.Parent.Parent.Parent.Description.Text = script.DescValue.Value script.Parent.Parent.Parent.ProductTitle.Text = script.TitleValue.Value script.Parent.Parent.Parent.SwordCost.Text = script.CostValue.Value script.Parent.Parent.Parent.SwordDamage.Text = script.DamageValue.Value end) script.Parent.MouseLeave:connect(function() script.Parent.Parent.Parent.ProductImage.Image = 'rbxassetid://' script.Parent.Parent.Parent.Description.Text = '' script.Parent.Parent.Parent.ProductTitle.Text = '' script.Parent.Parent.Parent.SwordCost.Text = '' script.Parent.Parent.Parent.SwordDamage.Text = '' end)
Is it a LocalScript? It should be a LocalScript.
You have FE enabled. The client cannot change anything in the real server. Either disable FE(Not recommended) or use RemoteEvents to make the server do it(recommended).
Try using WaitForChild()
, it works in solo play but in server play, you need to wait for everything to lad first. For example, let's say you want your GUI's to load, simply do this:
game:WaitForChild("StarterGui") --the rest of your stuff.
Hope this helped.