Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Currency Exchanging on touch will not work?

Asked by 4 years ago

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)
0
I tested this and it seems to work, it may be another script interfering. Player1_Joined 271 — 4y
0
it also didnt work for me hot_spi 20 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

It works now. Still no idea what the initial problem was I've changed nothing

Ad

Answer this question