i wanna make the character look at a item, and a blocks front surface is the view point, but when i step on the block, it says: Attempt to index nil with "Camera" on line 10?

--Variables--
local Brick = script.Parent
--End--

--Code--
local function PlayerTouched(Part)
	local Parent = Part.Parent
	if game.Players:GetPlayerFromCharacter(Parent) then
		script.Parent.Sound:Play()
		game.Players.LocalPlayer.Camera = workspace.Cameras.YourHand.FrontSurface
	end
end
Brick.Touched:connect(PlayerTouched)

4 comments

0

Is this a local script?

0

yes

0

Local script doesnt work in workspace

0

Local script doesnt work in workspace