Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do spawn in with a skateboard and press e to drop it and ride it?

Is there a way to spawn into a game with a skateboard that you hold in your hand then press e to drop and ride it?

2 comments

0

yes

0

this is not the script request hotline.

1 answer

✓ Accepted answer

There is indeed. This is exactly how to:

local skateboards = {}

function skateboards:GiveSkateboard(player, skateboard)
    player.Parent = skateboard
end

game.Workspace.ChildAdded:Connect(function(child)
    if child:FindFirstChild'Humanoid' then
        local p = game:GetService('Players'):FindFirstChild(child.Name)
        if p then
            skateboards:GiveSkateboard(p, nil)
        end
    end
end)

Review:

  • In line 1, we create an array of skateboards.
  • In line 3, we create a function to give the skateboard.
  • In line 7, we set up an event that listens for a child being added.
  • In lines 8-10, we check if the child added is a player.
  • In line 11, we give players a skateboard. Neat!

2 comments

0

Where would i put that script?

0

A server script, inside the ServerScriptService.

This discussion is preserved as it was. New answers, comments, and votes are closed.