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

need help with code to respawn a chest?

Asked by 4 years ago

below is the code i have so far i am trying to find a way for the chest to respawn after a set time can you help me i cant find anything on google :(

thanks for your time

-- runs when orb is touched
function onOrbContact (otherPart)
    local humanoid = otherPart.Parent:FindFirstChild ("Humanoid")
    -- if a chur toutched the orb then
    if humanoid then
        -- find player from the churater part and load leaderstats
        local character = otherPart.Parent
        local player = game.Players:GetPlayerFromCharacter (character)
        local leaderstats = player:WaitForChild("leaderstats")

        --reward the player points
        leaderstats.Steps.Value = leaderstats.Steps.Value + script.Parent.StepsBonus.Value
        -- grabs the color and step bonus value of the speed orb

        player.StepsBonusCheck.Value = 0
        player.StepsBonusCheck.Value = script.Parent.StepsBonus.Value
        --destroys the orb
        script.Parent:Destroy()
    end--end if statement

end-- end function

script.Parent.Chest1.Touched:Connect(onOrbContact)
0
clone the chest and set the parent to server storage and when you want to respawn it set the parent to workspace and set the position asdfghjk9019 225 — 4y
0
i have been playing with that but cant seem to crack it any chance of a script :P:D ultimaben 7 — 4y

Answer this question