I have this script (not a "Local Script") in a click detector and it works perfectly fine in local but when i go in a server it wont work, no errors in the output. Any help?
repeat wait(2)
player = game.Players.LocalPlayer
until player
function onClicked()
local a = player.PlayerGui
local gui = script.Parent.HatGui:Clone()
gui.Parent = player.PlayerGui
player.Character.Humanoid.WalkSpeed = 0
gui.Frame.Col1.Disabled = false
gui.Frame.Main.Disabled = false
local cam = workspace.CurrentCamera
cam.CameraSubject = player.Character.Head
cam.CameraType = "Scriptable"
local target = player.Character.Head
cam.CoordinateFrame=CFrame.new(target.Position) * CFrame.Angles(0, math.rad(0), 0) * CFrame.new(4, 0, 4)
end
script.Parent.MouseClick:connect(onClicked)

1 comment
if it's not a local script then line 2 will not work