Didint work thou, also can you tell me the changes that u made??
i mostly changed the argument on “event.OnClientEvent:Connect(function(part)” when it was player before
Remove game.Players.LocalPlayer
, you can’t use it in a server script.
already but nothing work…any suggestion??
I also have a script that is closely related to this part
this is client side
‘’’
local pizza = game.ReplicatedStorage.Food.PizzaDeliver
local player = game.Players.LocalPlayer
local event = game.ReplicatedStorage.Remotes.CookPizza
event.OnClientEvent:Connect(function(player)
wait(math.random(1 , 10))
local tabelspawner = game.Workspace.PizzaSpwner:GetChildren()
local randomspawner = tabelspawner[math.random(1 , #tabelspawner)]
local clone = pizza:Clone()
clone.Parent = game.Workspace.PromptInterract
clone.CFrame = randomspawner.CFrame
print(randomspawner)
end)
‘’
‘’’
local part = script.Parent
local part2 = game.Workspace.PromptInterract.CafeCounter2
local cafe1 = game.Workspace.PromptInterract.DonutCounter1
local cafe2 = game.Workspace.PromptInterract.DonutCounter2
local grocery1 = game.Workspace.PromptInterract.GorceryCounter1
local grocery2 = game.Workspace.PromptInterract.GorceryCounter2
local pro = script.Parent:WaitForChild(“ProximityPrompt”)
local label = game.StarterGui.MenuGui.roleplaylabel
local event = game.ReplicatedStorage.Remotes.TakeDonutsJobEvent
local player = game.Players.LocalPlayer
local button = game.StarterGui.MenuGui.roleplaylabel:WaitForChild(“QuitButton”)
local event2 = game.ReplicatedStorage.Remotes.VisibleQuitGui
script.Parent.ProximityPrompt.Triggered:Connect(function(player)
game.ReplicatedStorage.Remotes.CookPizza:FireClient(player)
game.ReplicatedStorage.Remotes.TakePizzJobEvent1:FireClient(player)
game.ReplicatedStorage.Remotes.VisibleQuitGui:FireClient(player, button)
game.ReplicatedStorage.Remotes.DisableProximity:FireClient(player)
end)
‘’’
this is server side:
OnClientEvent isn’t used on server script, it is used on client script and game.Players.LocalPlayer should work
he don’t need, he only pass player argument and a part to the client which mean, only the part is passed
replace the word player here by something else, you aren’t passing a player argument
Do you mean i need to put another argument beside player??
try this solution if you can:
Client
local player = game.Players.LocalPlayer
local event = game.ReplicatedStorage.Remotes.DeliverPizza
event.OnClientEvent:Connect(function(part)
local char = player.Character or player.CharacterAdded:wait()
local hum = char:FindFirstChild("Humanoid")
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://6798321493"
animation.Parent = script
local trackanimation = hum.Animator:LoadAnimation(animation):Play()
print(player.Name.."Dliverd")
end)
Server
local part = script.Parent
local remotes=game.ReplicatedStorage:WaitForChild("Remotes")
local DeliverPizza_event=remotes:WaitForChild("DeliverPizza")
part.ProximityPrompt.Triggered:Connect(function(player)
local chr=player.character
local hum=chr:FindFirstChild("Humanoid")
if hum~=nil then
local lhand=chr:FindFirstChild("LeftHand")
part.ProximityPrompt.Enabled = false
DeliverPizza_event:FireClient(player , part)
print(player.Name.."fire pizza")
local weld = Instance.new("Weld")
weld.Parent = part
weld.Part0 = part
weld.Part1 = lhand
local charclone = chr: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)
If I use Remote Function…will something happen?
Btw @Aanggoodluck nothing happen … any other solution
try this code and see what is printed in the output
Client
local player = game.Players.LocalPlayer
local npc = game.ReplicatedStorage.Character
local remotes=game.ReplicatedStorage:WaitForChild("Remotes")
local deliverPizzaEvent = remotes:WaitForChild("DeliverPizza")
local pizza = game.ReplicatedStorage.Food.PizzaDeliver
deliverPizzaEvent.OnClientEvent:Connect(function(text)
print(text.." from server")
end)
Server
local part = script.Parent
local remotes=game.ReplicatedStorage:WaitForChild("Remotes")
local deliverPizzaEvent = remotes:WaitForChild("DeliverPizza")
part.ProximityPrompt.Triggered:Connect(function(player)
deliverPizzaEvent:FireClient(player , "hello")
print("server fired remote to client")
end)
sorry can’t guess what’s going on without any hierarchial screenshots or what you want to achieve
what i provided above should answer your question
’ My Remote Event wont Firing?’
Its supposed to be a NPC(aaaaaaaaaaaaaaaaaa)