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

Argument 1 Missing or Nil?

Asked by 8 years ago

** In a localscript in a gui in playergui **

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AdvertiseEvent = ReplicatedStorage:WaitForChild("AdvertiseEvent")
AdvertiseEvent.OnClientEvent:connect(function()
    print(player)
    script.Parent:TweenPosition(UDim2.new(0.4,0,0.35,0),'InOut','Quad',1,false)
end)

** in a script inside of a brick in workspace **

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AdvertiseEvent = ReplicatedStorage:WaitForChild("AdvertiseEvent")
local Click = script.Parent:WaitForChild("Click")
Click.MouseClick:connect(function()
    AdvertiseEvent:FireClient()
end)

17:37:08.274 - Argument 1 missing or nil 17:37:08.277 - Script 'Workspace.Advertise.AdvertiseBrick.Script', Line 14

2 answers

Log in to vote
2
Answered by 8 years ago

FireClient

Your first argument needs to be the Player you're sending the event to. Otherwise, you can use FireAllClients

0
Is it possible to get the person whos clicking the brick?? TheShiningSavior 10 — 8y
0
... User#6546 35 — 8y
1
Look up the event in the wiki and you will find your answer. M39a9am3R 3210 — 8y
Ad
Log in to vote
0
Answered by
Klamman 220 Moderation Voter
8 years ago

ClickDetectors, dialog chats, and a few other objects are initiated by the client, and so when dealing with FilteringEnabled, you have to fire from the client in a LocalScript, not a regular script in a brick on the server.

Answer this question