local player = game.Players.LocalPlayer
local currency = player:WaitForChild('leaderstats').Coins
local amount = 200
local tool = game.ServerStorage: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)
I don't get why it doesn't work in an actual server. Anyone know why?

1 comment
It's both, although Clone is preferred.