So, I’ve made a script for a game that’s coming up. I’ve also seen a camera script for a GUI before, but just copied it over to this part. Here’s the script:
local remote = game.ReplicatedStorage.EpicCameraSauce
script.Parent.Touched:Connect(function(plr)
local camera = workspace.CurrentCamera
local cameragoal1 = 70
local cameragoal2 = 70
local flash = workspace.Sniper.flash
local sniper = workspace["sniper man"]
local reload = workspace.Sniper.hold.reload
local kill = workspace.sniper_KillPart1
local kill2 = workspace.sniper_KillPart2
kill.Position = Vector3.new(92.392, -15.311, -128.382)
kill2.camera.Enabled = false
repeat task.wait()
camera.CameraType = Enum.CameraType.Scriptable
until camera.CameraType == Enum.CameraType.Scriptable
task.wait(0.07)
if camera.CameraType == Enum.CameraType.Scriptable and camera.FieldOfView == cameragoal2 then
camera.CFrame = workspace.Menu.SniperCam.CFrame
camera.FieldOfView = cameragoal1
print("Worked.")
wait(0)
flash.shoot:Play()
flash.BillboardGui.Frame.ImageLabel.ImageTransparency = 0
wait(.2)
sniper.Head.boom:Play()
sniper.Head.face.Transparency = 1
sniper.Head.talk.Transparency = 0
flash.BillboardGui.Frame.ImageLabel.ImageTransparency = .33
wait(.1)
flash.BillboardGui.Frame.ImageLabel.ImageTransparency = .67
wait(.1)
flash.BillboardGui.Frame.ImageLabel.ImageTransparency = 1
wait(.225)
sniper.Head.face.Transparency = 0
sniper.Head.talk.Transparency = 1
wait(.15)
reload:Play()
wait(.15)
sniper.Head.face.Transparency = 1
sniper.Head.talk.Transparency = 0
wait(.7)
sniper.Head.face.Transparency = 0
sniper.Head.talk.Transparency = 1
wait(2)
camera.CameraType = "Custom"
camera.FieldOfView = cameragoal2
kill.Position = Vector3.new(92.392, 13.382, -128.382)
kill2.camera.Enabled = true
elseif sniper.Head.boom.Playing == true then
while true do end
elseif camera.CameraType == not Enum.CameraType.Scriptable then
print("Why is the Camera not Scriptable? Oh yeah, we didn't waited long enough, or the camera won't be scriptable.")
--Do you want more if the camera's FOV is 120?
elseif camera.FieldOfView == cameragoal1 then
camera.FieldOfViev = cameragoal2
print("FOV: "..camera.FieldOfView)
end
end)
The problem is that the script doesn’t just doing for client, it does it for everyone in the server. (The RunContext is set to Client, not Legacy.)
What should I do? Should I set the camera script to a LocalScript, and set the parts to a normal script, or something else?
TDLR; The script is fine except is not client sided. What do I do?