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

How would I make a seat lock the player who's sitting in it first person?

Asked by
notfenv 171
5 years ago

Ignore my shirt, it's offensive. Anyway, I'm trying to find a way on how to make a seat lock the player who's sitting in it into first person, I have already done this with a chat teleport script, but it gets the character by whoever says the word. I'd like to know how to do this due to the reasons of one of the groups I work as a Vice Administrator, the O5-Council in this group are slacking and are doing abusive behaviours so I thought I'd type out a document of purging the council including the O5X. I said that I'd put them through harsh torture with potential epilepsy and taser treatment. Please do not question me.

1 answer

Log in to vote
3
Answered by
0_2k 496 Moderation Voter
5 years ago
players = game:GetService("Players")

seat = script.Parent
active = false
plr = nil

seat.ChildAdded:Connect(function(child)
    if not active then
        if child.Name == "SeatWeld" then
            Active = true
            plr = players:GetPlayerFromCharacter(child.Part1.Parent)
            if plr ~= nil then
                plr.CameraMode = Enum.CameraMode.Classic
                wait()
                plr.CameraMode = Enum.CameraMode.LockFirstPerson
            end
        end
    end
end)

seat.ChildRemoved:Connect(function(child)
    if child.Name == "SeatWeld" then
        if Active == true then
            Active = false
            plr.CameraMode = Enum.CameraMode.LockFirstPerson
            wait() -- I've did this & vice versa so that roblox doesn't mess with it, weird.
            plr.CameraMode = Enum.CameraMode.Classic
        end
    end
end)
Ad

Answer this question