Attempt to index nil with 'Parent'

Send the local script that fires the remote event.

local team = BrickColor.new("Camo") --Colour of the class
local event = game.ReplicatedStorage:WaitForChild("Changeteam")
local toolevent = game.ReplicatedStorage:WaitForChild("GiveTools")
local frame = script.Parent.Parent
local load = frame.Parent.Loading
local success = frame.Parent.Success
local sound = game.SoundService.Click
local ding = game.SoundService.Success
local tool = game.ReplicatedStorage:WaitForChild("Economy Class")

script.Parent.MouseButton1Click:Connect(function()
	sound:Play()
	frame.Visible = false
	load.Visible = true
	wait(math.random(2,5))
	event:FireServer(team)
	toolevent:FireServer(tool)
	load.Visible = false
	success.Visible = true
	ding:Play()
	wait(2)
	success:TweenPosition(UDim2.new(0.5,0,-1.5,0))
	wait(1)
	for i = 0.4, 1, 0.05 do
		frame.Parent.Blur.BackgroundTransparency = i
		wait(0.1)
	end
	frame.Parent:Destroy()


end)

try this instead:

toolevent:FireServer(player, tool)

It now gives this error

ServerScriptService.CheckIn_Handler:10: attempt to index nil with 'Clone'  -  Server - CheckIn_Handler:10

By the way, isnt “player” fired automatically?

The tool when cloned, is not immediately put to it’s parent which is why it errors, it has no parent and thus, no properties.

Try first cloning it from replicated storage and if that doesn’t work tell me.

It seems to give this error

ServerScriptService.CheckIn_Handler:10: attempt to index nil with 'Clone'  -  Server - CheckIn_Handler:10

But when I install my system in another place it seems to work.

Where did you have it originally?

I put the tool in ReplicatedStorage, with my clone script in ServerScriptService. Idk why is doesnt work in this particular experience.

What about the local script, where did you put that?

Remove the player from that.
It won’t work.

Instead, do like this

toolevent:FireServer() -- don't send the tool in the args

And in the server script

Do this

local tool = game.ReplicatedStorage:WaitForChild("Economy Class")

givetool.OnServerEvent:Connect(function(player)
	tool:Clone().Parent = player.Backpack
end)

If that doesn’t work then re-check if the instance actually exists, if it does then re-check the name.

Also, to people who are telling to do this:

remoteEvent:FireServer(player, ...)

This is totally wrong. You’re already automatically getting player as the first argument when receiving the event from the server. So, just send the arguments to the server if you have any.

I put the local script in a textbutton in my gui.
The gui is then cloned to playergui when the player activates a proximityprompt.

It throws this error

ServerScriptService.Script:11: attempt to index nil with 'Parent'  -  Server - Script:11

I am totally confused since it works elsewhere

Can you send a picture of the ReplicatedStorage?

Screenshot 2022-02-14 at 6.02.41 PM
Here ya go

Really weird. Can you go check in-game if the tool actually exist?

Try instancing the tool because the problem with the script is probably the fact when it gets cloned, it doesn’t get a parent set instantly.

The only solution I could think of is instancing the tool.


I checked with adonis and yes, it exists!

It’ll only create the tool, but it won’t create the parts inside it.

I tried instancing a blank tool and it works

However, how would I put the parts inside it?