Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Problem with remote event?

Asked by
RoyMer 301 Moderation Voter
9 years ago

This is not working and not giving any output.

In the server script (The part of the remote event)

function ClearCamera()
local event = v.Backpack.ClearCamera
wait(1)
event:FireClient(ClearCamera)
end     

In the Backpack's RemoteEvent named ClearCamera's Local Script:

local event = script.Parent:WaitForChild("ClearCamera")

event.OnClientEvent:connect(function()
    game.Workspace.CurrentCamera:ClearAllChildren()
    print("EventHappened")
end)
0
I don't think your giving us the whole script? Is "ClearCamera()" being fired? Nickoakz 231 — 9y
0
Oh no you're right the function ClearCamera() is unneccesary I think but at line 4 it is saying 'Argument 1 missing or nil' now? RoyMer 301 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

Line 4 of the first script should be "event:FireClient(v)" -- you need to pass it the player as the first argument.

Don't forget that this code can error if the player leaves while you're executing this code. If the thread shouldn't die, use "pcall"; an example is found in the [tutorial](http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial].

Ad

Answer this question