#Script doesn't work

1 messages · Page 1 of 1 (latest)

devout sail
#

Hi, so i want to make a claim part where if you touch it you get 100 money, anyway, i have these two scripts for that and it doesnt seem to work.
script 1:


function leaderboardSetup(player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player
    
    local money = Instance.new("IntValue")
    money.Name = "Money"
    money.Parent = leaderstats
    money.Value = 0
    
    if shared.press == 1 then
        money.Value += 100
        shared.press = 0
    end
end

Players.PlayerAdded:Connect(leaderboardSetup)

script 2:


shared.press = 0


claimPart.Touched:Connect(function(otherPart)
    local Humanoid = otherPart.Parent:FindFirstChild("Humanoid")
    if Humanoid then
        shared.press = 1
    end
    
    
end)

there are no errors or anything

west escarp
#
    if shared.press == 1 then
        money.Value += 100
        shared.press = 0
    end``` this only runs once at the time the leaderboard is set up, it doesn't magically know to run again based on shared.press
#

coz what if you set shared.press to 2?

devout sail
#

so i put it in a while true loop?

#

oh yeah that worked

#

but i had to put a wait obviosuly

devout sail
#

oh

#

this whole thing is useless

#

it wont work beyond one player

#

im stupid