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

What is wrong with this model relocator?

Asked by 10 years ago
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
    end
end)

script.Parent.ChildAdded:connect(function(child)
    while wait(0.2) do
        if script.Parent:FindFirstChild("SeatWeld") == nil then
            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
        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

0
@supermarioworld323 Be patient. You posted this 24 minutes ago at this point, which is a very short period of time compared to some of other people's waiting period. A forum site doesn't always grant you instant answers. Redbullusa 1580 — 10y
0
good point.. supermarioworld323 45 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

Line 13, change it to ChildRemoved event, instead, since it seems this would be code for that type of situation.

0
Yeah but how do you make it so it works on server mode ._. supermarioworld323 45 — 10y
0
I'll test it, but this *should* work in server mode also. I just referenced crazyman32's planekit code and it does the same thing and works in server mode. What error are you getting on the serer when you try it? JasonTheOwner 391 — 10y
Ad

Answer this question