code:
function onClicked() game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(26.2, -10.855, 319.8)) game.Workspace.Sounds.DinkSecretRoom:Play() end script.Parent.ClickDetector.MouseClick:connect(onClicked)
THIS IS IN A NORMAL SCRIPT, IF ITS IN A LOCALSCRIPT IT BREAKS. PLEASE HELP ME. I NEED TO CALL A LOCALPLAYER BUT WITHOUT LOCALPLAYER. SORRY FOR CAPS I WAS TO LAZY TO TYPE AGAIN.
While LocalPlayer
can only be accessed through a Local Script, in your case, you could simply use the Player value of the ClickDetector
object. Here's a better version of your code:
function onClicked(player) player.Character.HumanoidRootPart.CFrame = CFrame.new(26.2, -10.855, 319.8) game.Workspace.Sounds.DinkSecretRoom:Play() end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Also do note that CFrame.new doesn't require Vector3.new to be inside it.