Button press not activating camera

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)
	
local part = script.Parent

local button = part.Touched:Connect(function(hit)
	print("Hello")
	game.Workspace.Camera.CameraType = Enum.CameraType.Scriptable
	game.Workspace.Camera.CFrame = CFrame.new(game.Workspace.camPart.Position, game.Workspace.focus.Position)
end)

The problem still persists, although if it’s in anyway helpful this is also where my script is located:
image

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)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.