so basically i have a gui button and a first person script - how do I make it so you go into first person - from a fixed camera - after you press the button?
they are in seperate scripts
so basically i have a gui button and a first person script - how do I make it so you go into first person - from a fixed camera - after you press the button?
they are in seperate scripts
You can do it in 2 steps.
local button = path to the button
local Player = game.Players.Localplayer
button.Activated:Connect(function() -- checks if the button is touched, if it is, it runs anything inside of the function
Player.CameraMode = Enum.CameraMode.LockFirstPerson -- change the camera to first person
end)
That should be it!
Reply if there is anything you need more explanation on.
What would the path to the button be? would it be game.startergui.menu.frame.imagebutton?
Also it doesnt put me in first person
Let's say you put the localscript inside of the button. The path would be "script.Parent" I reccomend putting the localscript inside of the parent. Game.StarterGui won't work because the starter gui gets replicated to each player, becoming playerGui
Yield it with something like
Button.MouseButton1Down:Wait()
What does that mean? im new to scripting
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Yield it with something like
script.ClickDetector.MouseButton1Down:Connect(function()