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

Teleporting parts to the character wont work?

Asked by 7 years ago
Edited 7 years ago

I'm trying to make a script that makes a model from lighting (Board) be cloned into the character and move to the characters position. Right now it spawns the board moves it o the character directory but dosen't move to the character. so far i've got this.


game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) processCommand(player, message) end) end) function processCommand(speaker, message) if message == "spawn board" or message == "spawn Board" or message == "Spawn Board" or message == "Spawn board" then print(speaker.Name) board = game.Lighting.Hoverboard:Clone() board.Parent = speaker.Character local pos = speaker.Character:GetModelCFrame() wait() board.SkateboardPlatform.Position = Vector3.new(pos) end end

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Nevermind, this should do.

game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(message)
        processCommand(player, message)
    end)
end)




function processCommand(speaker, message)
    if message == "spawn board" or message == "spawn Board" or message == "Spawn Board" or message == "Spawn board" then
        print(speaker.Name)
        board = game.Lighting.Hoverboard:Clone()
        board.Parent = speaker.Character
        local pos = speaker.Character.Torso.Position
        wait()
        board.SkateboardPlatform:MoveTo(pos)
    end
end

0
(message == "spawn board" or message == "spawn Board" or message == "Spawn Board" or message == "Spawn board") can be shortened to (message:lower() == "spawn board") DigitalVeer 1473 — 7y
Ad

Answer this question