I am trying to make a script to talk to someone. I want to script it so when you click them a gui at the bottom of your screen pops up and your camera goes to a part infront of the characters face. I have no errors, but it the camera moving doesn’t seem to work, everything else does.
Here is my script (in the torso of the character I want to talk to):
script.Parent.MouseClick:Connect(function(plr)
local hum = plr.Character.Humanoid
local space = game:GetService("Workspace")
local players = game:GetService("Players")
local CurrentCamera = space.CurrentCamera
local part = workspace.CamPart
CurrentCamera.CameraType = Enum.CameraType.Scriptable
CurrentCamera.CFrame = part.CFrame
plr.PlayerGui.ShopGui.Enabled = true
hum.WalkSpeed = 0
hum.JumpPower = 0
end)
Thank you for your time!
Is this a server script or a local script? I think editing the camera requires it to be client sided instead of server sided since you’re trying to edit something that is different for each client
It is a regular script, is it possible for you to elaborate a bit more on how I would edit the camera with a local script? Thanks 
Try converting the entire script you have right now to a localscript, it should work if you do that, I think you’d have to change
plr.PlayerGui.ShopGui.Enabled = true
to
players.LocalPlayer.PlayerGui.ShopGui.Enabled = true
I tried this and it didn’t work, I think that click functions don’t work in local scripts 
Wait wait, you’d have to put the localscript inside of somewhere where tehy can run, maybe put it in StarterPlayerScripts and change script.Parent to the location of the clickdetector?
local detector = --Location of detector
local players = game:GetService("Players")
local localplr = players.LocalPlayer
detector.MouseClick:Connect(function(plr)
if plr ~= localplr then return end
local hum = plr.Character.Humanoid
local space = game:GetService("Workspace")
local CurrentCamera = space.CurrentCamera
local part = workspace.CamPart
CurrentCamera.CameraType = Enum.CameraType.Scriptable
CurrentCamera.CFrame = part.CFrame
plr.PlayerGui.ShopGui.Enabled = true
hum.WalkSpeed = 0
hum.JumpPower = 0
end)
Localscripts can’t run in the workspace
2 Likes
tysm this works perfectly!!! 
1 Like
Anytime! If you have anymore issues don’t be afraid to make another post!
1 Like