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

Im getting an Arguement 1 missing or nil error? any help with this issue?

Asked by 4 years ago
Edited 4 years ago

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)

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Using fireclient requires you to have a client object inside the parameter. Tell it what client it should be firing it to. You need to put a client object in there such as a name.

I suggest checking this out https://developer.roblox.com/api-reference/function/RemoteEvent/FireClient

0
Im confused? Go deeper. Pooglies 7 — 4y
0
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 Thesquid13 301 — 4y
0
Iv done that and its still not working. Pooglies 7 — 4y
Ad
Log in to vote
0
Answered by
Asentis 17
4 years ago

You're possibly using :FireClient() within a local script. Instead of :FireClient(), use :FireServer() as local scripts can't use :FireClient(), only regular scripts can.

Read more about this here: https://developer.roblox.com/api-reference/class/RemoteEvent

Answer this question