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

Am I doing this properly, if so is it cause the game is FilteringEnabled?

Asked by 8 years ago

I was wondering if anyone can tell me why this doesn't change the Parent of the Vehicle to the Player's character, but yet it does the other stuff like giving the GUI to the Player, and if I'm doing it properly, is it cause the game is FilteringEnabled? Script is in a ServerScript in the VehicleSeat.

Script(I didn't make it, just edited it.):

script.Parent.ChildAdded:connect(function(w)
    if w:IsA("Weld") then
        if w.Name == "SeatWeld" then
            if w.Part1.Parent:FindFirstChild("Humanoid") then
                pl = game.Players:GetPlayerFromCharacter(w.Part1.Parent)
                if pl then
                    if pl.PlayerGui:findFirstChild("SirenControl") then
                        pl.PlayerGui:findFirstChild("SirenControl"):Destroy()
                    else
                        script.Parent.Parent = pl.Character
                        local newgui = script.Parent.SirenControl:clone()
                        newgui.Parent = pl.PlayerGui
                        newgui.Frame.CarName.Value = script.Parent.Parent
                    end
                end
            end
        end
    end
end)

Answer this question