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

Why wont this model relocator thing move the model into player model?

Asked by 9 years ago

Ive asked this twice because no one answered on the last one

script.Parent.ChildAdded:connect(function(child)
    if (child.Name == "SeatWeld") then
        local Char = child.Part1.Parent
        local Human = game.Players:GetPlayerFromCharacter(Char)-- Relocate
        if (not Human) then
            return

        end
        local heli = script.Parent.Parent
        heli.Parent = game.Players.LocalPlayer.Character -- moves the heli into the player model
    end
end)

script.Parent.ChildAdded:connect(function(child) -- ignore this i made it like this
    while wait(0.2) do
        if script.Parent:FindFirstChild("SeatWeld") == nil then -- Checks if the seatweld is there or not
            local Char = child.Part1.Parent
            local Human = game.Players:GetPlayerFromCharacter(Char) -- Locate out (if left seat)
        if (not Human) then
            return
        end
        local heli = script.Parent.Parent
        heli.Parent = game.Workspace -- moves the heli out of the player model
        end 
    end
end)

This is placed in a seat. It works perfectly fine in studio but in server mode, the helicopter model doesn't move into the player model.

1 answer

Log in to vote
0
Answered by 9 years ago

You are using the wrong method on line 10: game.Players.LocalPlayer in studio is you, it exists, but in server mode, this script has to be a normal script inside workspace,

and let's replace that line 10 to:

heli.Parent = Human.Character

If it doesn't work, i don't know what doesn't. ~marcoantoniosantos3

0
Finally! it worked! thank you... supermarioworld323 45 — 9y
Ad

Answer this question