So I’m trying to make it so if a player stands on a button then the camera is moved to look at an object.
unfortunately all it does is print the hello thing while not actually doing anything else.
I’ve tried different methods for doing this, like having it as a localscript somewhere else and the button press merely enabling the script to do something then using a wait to get it to disable the script once more.
Unfortunately the result was the same where it simply just didn’t do anything. The script did seem to kind of work at first when it’s placed onto ground.
This is the script I was using.
local part = script.Parent
local button = part.Touched:Connect(function(hit)
print("Hello")
game.Workspace.Camera.CameraType = "Scriptable"
game.Workspace.Camera.CFrame = CFrame.new(game.Workspace.camPart.Position, game.Workspace.focus.Position)
end)
Oh its because youre using a Server Script, I would recommend making a LocalScript in StarterPlayer → StaterPlayerScripts and pasting this code inside it:
local part = workspace.Part --// Change to the Path of the part
part.Touched:Connect(function(hit)
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
game.Workspace.CurrentCamera.CFrame = CFrame.new(game.Workspace.camPart.Position, game.Workspace.focus.Position)
end)