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

My SELL is not working also if i debug it with Print() nothing printing on the console?

Asked by 5 years ago
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.Money
    local Selling = leaderstats.Backpack
        if Selling.Value > 0 then
            Currency.Value = Currency.Value + Selling.Value *1
            Selling.Value = 0
        end
end
end
end)








0
is this in a script and not a localscript? TheRealPotatoChips 793 — 5y

2 answers

Log in to vote
-1
Answered by
NSMascot 113
5 years ago
Edited 5 years ago

change line 5 to this

local player = game.Players:WaitForChild(HIT.Parent) 
0
Still not working HandznLegz 18 — 5y
0
maybe change HIT to hit? NSMascot 113 — 5y
0
Still not Working :< HandznLegz 18 — 5y
0
can you post what your output is saying NSMascot 113 — 5y
View all comments (4 more)
0
it should be a server sided script (the blue one) NSMascot 113 — 5y
0
check line 9 NSMascot 113 — 5y
0
So i will add RemoteEvent? HandznLegz 18 — 5y
0
if its a local script then just copy the code from the local script into a server script, put the server script in the same place the local script was, then delete the local script NSMascot 113 — 5y
Ad
Log in to vote
-1
Answered by 5 years ago

Try a debounce system https://developer.roblox.com/en-us/articles/Debounce

--Code by roblox
function debounce(func)
    local isRunning = false    -- Create a local debounce variable
    return function(...)       -- Return a new function
        if not isRunning then
            isRunning = true

            func(...)          -- Call it with the original arguments

            isRunning = false
        end
    end
end

Answer this question