So I’m trying to make a takedown thing and I’m trying to use camera manipulation with remote events but I keep getting the error: “Argument 1 missing or nil” Why am I getting this error?
Here is the Hitbox script I have (Script)
local hitbox = script.Parent
local knife = game.StarterPack:FindFirstChild("Knife")
local db = true
hitbox.Touched:Connect(function(hit)
local char = hit.Parent
local hum = char:FindFirstChild("Humanoid")
local plr = game.Players:FindFirstChild(char.Name)
if db and hum and plr then
db = false
local KTF = plr:WaitForChild("KTF")
local KT = KTF:FindFirstChild("Takedown")
if KT.Value then
game.ReplicatedStorage.TakedownCam:FireClient()
script.Parent.Parent.Humanoid.Health = 10
else
print("Takedown is not available at the moment")
end
wait()
db = true
end
end)
Here is the RemoteEvent Script (LocalScript)
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local cam = workspace.CurrentCamera
local TakedownCam = game.Workspace.TakedownCam
game.ReplicatedStorage.TakedownCam.OnClientEvent:Connect(function()
repeat wait()
cam.CameraType = Enum.CameraType.Scriptable
until cam.CameraType == Enum.CameraType.Scriptable
cam.CFrame = TakedownCam.CFrame
end)
ServerScriptService is a service for the server. Local Scripts won’t execute if they are parented to the ServerScriptService.
Try putting your script in the StarterGui or StarterPlayerScripts.