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.
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).
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
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