I have a script to where it's supposed to take ores and turn them into Credits. It doesn't wanna work, and I'm quite confused as to why. Can anyone help me?
local Part = script.Parent Part.Touched:Connect(function(HIT) local H = HIT.Parent:FindFirstChild("Humanoid") if H then local player = game.Players:GetPlayerFromCharacter(HIT.Parent) if player then local leaderstats = player:WaitForChild("leaderstats") local Currency = leaderstats.Credits local Selling = leaderstats.Ores if Selling.Value > 0 then Currency.Value = Currency.Value + Selling.Value *5 -- This 1 means multiple you can change it to whatever you want Selling.Value = 0 end end end end)
It works now. Still no idea what the initial problem was I've changed nothing