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

I want to change the camera mode to first person when touching a part?

Asked by 7 years ago

I don't know how to do this, I am an amateur coder who used to raid the library in hoping of finding a script that'll help. But now that I'm using this, I can finally get help. So I want to change the camera to first person when they touch a part, but when they die, it switches back to the regular camera mode.

But I do not know how to do this, so can someone help me?

Reason being I'm trying to build a lobby and then when they get to the map, they will be stuck in first person.

Also, I'm trying to auto-equip a tool and get rid of the backpack, but I don't know how to do this either.

These are not requests, I am trying to learn more about coding because it is difficult.

1 answer

Log in to vote
0
Answered by 7 years ago

you're soooo lucky its christmas eve here

the touch script

In the brick that is being touch a regular script.

script.Parent.Touch:connect(function(hit)
    if hit.Parent == hit.Parent:FindFirstChild("Humanoid") then
    game.Players[hit.Parent.Name].CameraMode = "LockFirstPerson" -- Will lock the camera
    end
end)

A local script in starter Scripts On death change camera back

local player = game.Players.LocalPlayer
wait(1)
local char = player.Character

char.Humanoid.Died:connect(function()
    if player.CameraMode == "LockFirstPerson" then
        player.CameraMode = "Classic"
    end
end)

go on ROBLOX Wiki to learn how to script.

Wasn't on my pc to test it so tell me if something is wrong.

0
@GameBoyOtaku Sorry, it doesn't work. Message me once you are able to test it out. HimoutoUmaruDomaChan 20 — 7y
0
k GameBoyOtaku 63 — 7y
Ad

Answer this question