Hello
i wanted to kwo if tis is possible and if it is possible can some one help me?
i want to make it soo if you click a brick you will be in first person BUT only you (local script ig)
but i alredy tryed stuff like
game.Workspace.ClickDecEv.OnServerEvent:Connect(function()
game.StarterPlayer.CameraMode.LockFirstPerson = true
end)
and that dosent work
i put that script in remote event
and on Starter GUI i put a local script
local clickdetector = game.Workspace.First.ClickDetector
clickdetector.MouseClick:Connect(function()
game.Workspace.ClickDecEv:FireServer()
end)
i dont have any problem whit that but i just wanted to kwo if its posible
(sorry if bad english)
1 Like
btw on the part
game.StarterPlayer.CameraMode.LockFirstPerson = true
the LockFirstPerson dosent show
Sarchyx
(Sarchyx)
September 24, 2021, 5:27pm
#3
You should change it from the client.
workspace.ClickDecEv.OnServerEvent:Connect(function(client)
client.CameraMode.LockFirstPerson = true
end)
1 Like
It doesn’t have to be thru remoteevents btw, you can always handle this in a localscript only
CameraMode takes an enum, not a boolean
You should also just reference the local player, as only that will actually affect the player.
local player = game:GetService("Players").LocalPlayer
player.CameraMode = Enum.CameraMode.LockFirstPerson
1 Like
Sarchyx
(Sarchyx)
September 24, 2021, 5:38pm
#7
Thanks for correcting me, I’m on mobile and don’t have too much resources. Also instead of the RemoteEvent you can use mouse directly from a LocalScript.
local Mouse = Player:GetMouse()
Mouse.Button1Down:Connect(function)
-- Change CameraMode
end)
Remove the server script, it’s not needed.
Create a script in StarterPlayerScripts, name it whatever you want
Define player
and set it to game:GetService(“Players”).LocalPlayer
(aka local player = game:GetService(“Players”).LocalPlayer)
Then put the player.CameraMode inside of the MouseClick event.
by server script what do you mean?
soo i create a script on Starter player sripts and on the script i put
game:GetService(“Players”).LocalPlayer
local player = game:GetService(“Players”).LocalPlayer
sorry if i dont understand lol
This script:
jaguarYT7777:
soo i create a script on Starter player sripts and on the script i put
game:GetService(“Players”).LocalPlayer
local player = game:GetService(“Players”).LocalPlayer
Remove the first line, and put the connection from this image into your code:
(it’s the
clickdetector.MouseClick:Connect(function()
end)
part.
jaguarYT7777:
Then put
player.CameraMode = Enum.CameraMode.LockFirstPerson
inside the connection part:
clickdetector.MouseClick:Connect(function()
-- here!
end)
like this?
and on the
(it’s the
cuts
part
or if you can you can just write the script pls
Just define clickdetector on top of the script like you did in this image:
You’re not gonna really learn anything if I just give you free code
ok soo i put
local clickdetector = game.Workspace.First.ClickDetector
clickdetector.MouseClick:Connect(function()
like that or the full code
btw i was saying bc i dont wanna waste your time
Just add local clickdetector = game.Workspace.First.ClickDetector
to the top, you don’t need to remove or replace anything
Yep – should work as expected now.
but the on the
player.CameraMode = Enum.CameraMode.LockFirstPerson
the player shows on orange and dosent work
Right, forgot that you should also define the player on top of the clickdetector definition
local player = game:GetService("Players").LocalPlayer
Sorry!
oof give me 5 mins to try fixing it ok? if i dont answer on 5 mins you can help me but i wanna try this bymiself
idk why i alredy have the script
but like i tell you i want it soo when you click
the brick called first you put of first person soo im kinda confused
1 Like