My Remote Event wont Firing?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

    I want my remote event to fire when proximity prompt triggered

  2. What is the issue? Include screenshots / videos if possible!
    Remote Event did not fire at all

robloxapp-20210522-1638131.wmv (310.1 KB)

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

    I remove the remote event .still not working

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

here is my code:

local player = game.Players.LocalPlayer
local character = game.ReplicatedStorage.Character
local event = game.ReplicatedStorage.Remotes.DeliverPizza
local part = game.ReplicatedStorage.Food.PizzaDeliver

event.OnClientEvent:Connect(function(player)
	
	part.ProximityPrompt.Enabled = false
	local char = player.Character or player.CharacterAdded:wait()
	local hum = char:FindFirstChild("Humanoid")
	local leftHand = char:WaitForChild("LeftHand")

	

	if hum then
		
		local animation = Instance.new("Animation")
		animation.AnimationId = "rbxassetid://6798321493"
		animation.Parent = script

		local trackanimation = hum:LoadAnimation(animation):Play()

		local weld = Instance.new("Weld")
		weld.Parent = part
		weld.Part0 = part
		weld.Part1 = leftHand

		print(player.Name.."Dliverd")
		
		local charclone = character:GetChildren()
		local randomclone = charclone[math.random(1 , #charclone)]

		local spawntable = game.Workspace.CharacterSpawner:GetChildren()
		local randomspawner = spawntable[math.random(1 , #spawntable)]

		local clone = randomclone:Clone()
		clone.Parent = game.Workspace.PromptInterract
		clone:MoveTo(randomspawner.Position)


		print(clone.Name)
	end
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

You’re only showing the script that shows the output of the Remote Event being fired. Show us the script that’s suppose to fire the remote event.

this is the code suppose to fire the remote event:

‘’’
local player = game.Players.LocalPlayer
local part = script.Parent

part.ProximityPrompt.Triggered:Connect(function(player)

game.ReplicatedStorage.Remotes.DeliverPizza:FireClient(player , part)
print(player.Name.."fire pizza")

end)

‘’’

Is this code in a server script or local script?

its server scripts and parented to part

Idk if this causes a problem or not, but you should remove this line from your server script, because it only works in a local script (game.Players.LocalPlayer is nil in a server script).

same …its still not working.any suggestions??

Wrap the entire server script in a playerAdded function, and pass the player parameter as the player.

You used a first variable player before your remote event then a second key named as the same as your variable, maybe it is an issue

Also you use the key player here, instead of doing:
local char = player.Character

I would do

local char = workspace:FindFirstChild(player.Name)

should i change it ??
to this
local char = workspace:FindFirstChild(player.Name)

I am using it for every remote event and it works for me. Maybe it won’t fix your issue but hey you have nothing to lose to try this :eyes:

sill not working…any other suggestions?

Nvm i mistook it with OnServerEvent, sorry. But now, just before « if hum them », print(hum) just to see what you get

Also, when you use OnClientEvent, the parameter doesnt gives the player. It isnt the same as OnServerEvent. What is the argument you used on the server script? Show us the server script please @EducatedPilot04

this

local player = game.Players.LocalPlayer
local part = script.Parent

part.ProximityPrompt.Triggered:Connect(function(player)


game.ReplicatedStorage.Remotes.DeliverPizza:FireClient(player , part)
print(player.Name.."fire pizza")


end)

So in fact, the argument player is to who you fire the event. When you use the argument player on the local script, you use the argument part on the server

Wrong because this can be used only on localScripts

To get the player on the server:

game.Players.PlayerAdded:Connect(function(player)
    game.ReplicatedStorage.Remotes.DeliverPizza:FireClient(player, part)
end)

Now imagine the argument « part » with it:
local char = player.Character or player.CharacterAdded:wait()

I am not sure but try this code. If it is wrong, i will check it once i am at home.