Hello , so i’m trying to make kicker gui that allows you to kick a person out of the room.
I’ve been getting an error “Argument 1 missing or nil”. I have no idea how to fix it because the argument 1 exist. Also , im using 2 remoteevent (client & server).
Any help would be really appreciated!
21:06:51.787 - Argument 1 missing or nil
21:06:51.788 - Stack Begin
21:06:51.788 - Script 'Workspace.TheFuzi.LocalScript', Line 45
21:06:51.788 - Stack End
Error is in the script below.
Client:
game.ReplicatedStorage.KickEventOnClient.OnClientEvent:Connect(function(kicker,name,id)
if game.MarketplaceService:UserOwnsGamePassAsync(game.Players:GetPlayerByUserId(id).UserId,5754086) then -- error is here
canenter = false
plr.PlayerGui.playerList.note.Visible = true
plr.PlayerGui.playerList.note.text.Text = "You have been kicked out of the theater by " .. kicker.Name .. ". Please wait 15 seconds to enter the theater."
local s = Instance.new('Sound')
s.SoundId = "rbxassetid://261082034"
s.Parent = plr.Character.Head
wait(0.05)
plr.Character.Head.notif:Play()
wait(2)
plr.Character.Head.notif:Play()
wait(12.95)
canenter = true
end
end)
Client2:
if game.MarketplaceService:UserOwnsGamePassAsync(game.Players.LocalPlayer.UserId,5754086) then
script.Parent.button.Visible = true
end
local open = false
script.Parent.button.MouseButton1Click:Connect(function()
if open == false then
open = true
script.Parent.Frame.Visible = true
else
script.Parent.Frame.Visible = false
open = false
end
end)
script.Parent.note.TextButton.MouseButton1Click:Connect(function()
script.Parent.note.Visible = false
end)
script.Parent.Frame.button.MouseButton1Click:Connect(function()
if game.MarketplaceService:UserOwnsGamePassAsync(game.Players.LocalPlayer.UserId,5754086) then
if game.Players:FindFirstChild(script.Parent.Frame.name.Text) then
script.Parent.Frame.Visible = false
script.Parent.note.Visible = false
wait(0.1)
game.ReplicatedStorage.KickEvent:FireServer(script.Parent.Frame.name.Text,script.Parent.Frame.name)
end
end
end)
Server:
local timer = 180
game.ReplicatedStorage.KickEvent.OnServerEvent:Connect(function(player,who,whotext)
if workspace:FindFirstChild(who) then
if game.Players:FindFirstChild(who) then
workspace[who].HumanoidRootPart.CFrame = workspace.TeleportOutCFrame.CFrame * CFrame.new(0,3,0)
game.ReplicatedStorage.KickEventOnClient:FireClient(game.Players:FindFirstChild(who),game.Players:FindFirstChild(who).Name,game.Players:FindFirstChild(who).UserId)
end
end
end)
I think I see the problem after skimming through your code.
When you fire to the server, the first argument is 'script.Parent.Frame.name.Text' and the second one is script.Parent.Frame.name. However, in the server script, you have them reversed as the who parameter is referring to the script.Parent.Frame.name.Text
Try swapping the parameters in the KickEvent.OnServerEvent to (player, whotext, who)
I have no clue how your game works and I might be completely wrong, it would help if you were able to provide a place.
In the error you provided, it states it errored in Workspace.TheFuzi.LocalScript and you shouldn’t be using LocalScripts in workspace as there is no way for you to get the LocalPlayer through them since it is on the server.
Instead, move it to a Client folder such as StarterGui or StarterPlayerScripts and see if that fixes things.
Not to get off topic, but placing a LocalScript in StarterCharacterScripts places the script into your character, which looks like it might be the case here as the full path is “Workspace.TheFuzi.LocalScript”.