Im getting an Arguement 1 missing or nil error on line 21 of my script. Any help here?
dog = false
local rep = game.ReplicatedStorage
script.Parent.MouseButton1Click:connect(function()
local player = script.Parent.Parent.Parent.Parent.Parent
if player.hats.Money.Value == 0 then
print("Button1 Clicked")
dog = true
player.banking.Cash.Value = player.banking.Cash.Value - 80
player.hats.Money.Value = 1
player.hats.Money2.Value = 0
player.hats.Money3.Value = 0
player.hats.Money4.Value = 0
player.hats.Money5.Value = 0
player.hats.Money6.Value = 0
player.hats.Money18.Value = 0
player.hats.Money19.Value = 0
player.hats.Money20.Value = 0
else
if player.hats.Money.Value == 1 then
rep:WaitForChild("Error"):FireClient()
end
local character = player.Character
local d = character:GetChildren()
for i=1, #d do
if (d[i].className == "Accessory") then
d[i]:remove()
end
end
if character:findFirstChild("Humanoid") ~= nil then
h = Instance.new("Accessory")
p = Instance.new("Part")
h.Name = "Hat"
p.Parent = h
p.Position = character:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = character
print("SUCCESS")
h.AttachmentPos = Vector3.new(0, -0.20, 0)
wait(.1)
dog = false
end
end
end)

4 comments
Im confused? Go deeper.
So, you wanna fire this to a client. Inside the () you put a player object. Such as the name. Without that info, it can't know which client to send it to
Iv done that and its still not working.
Then you're doing it wrong. Read https://developer.roblox.com/api-reference/function/RemoteEvent/FireClient