Workspace.Ultra_Fletchder.Q:24: attempt to index nil with 'WaitForChild'

Says the error above on line 24 of the local script
Local Script:

local plr = game.Players.LocalPlayer




local uis = game:GetService("UserInputService")

local re = game.ReplicatedStorage:WaitForChild("AcidEcho")




local mouse = plr:GetMouse()

uis.InputBegan:Connect(function(key, processed)

	if key.KeyCode == Enum.KeyCode.Q and not processed then

		
re:FireServer()

		re.OnClientEvent:Connect(function(player, part)
part:WaitForChild("gui", 100).Enabled = true --Error Here
		end)
	end 


end)


Server Script:

local oncd = {}
local tpr = false

game.ReplicatedStorage.AcidEcho.OnServerEvent:Connect(function(plr)
if oncd[plr] then
return
end
oncd[plr] = true
local part = script:WaitForChild("Part"):Clone()
local char = plr.Character
local hrp = char:WaitForChild("HumanoidRootPart")
local pos = script:WaitForChild("Value")
if tpr == false then
pos.Value = hrp.CFrame

part.Parent = workspace
part.CFrame = pos.Value
	game.ReplicatedStorage.AcidEcho:FireClient(plr,part)
tpr = true
elseif tpr == true then
hrp.CFrame = pos.Value
part:Destroy()
tpr = false
end
wait(15)
oncd[plr] = false







end)
1 Like

The player is omitted from .OnClientEvent when you call :FireClient, so the first argument would actually be the part.

1 Like
re.OnClientEvent:Connect(function(part)
    part:WaitForChild("gui", 100).Enabled = true --Error Here
end)

the player isn’t necessary on OnClientEvent, the player is yourself

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.