I made an object with a server script inside, a remote event inside player character scripts, and a remote event inside replicated Storage. The thing works inside studio, but In-game it says Fireclient argument must be a player object. Any ideas? Thank you. this is server script
--Declare
--GameServices
local plr = game:GetService("Players").LocalPlayer
local Workspace = game:GetService("Workspace")
local repSto = game:GetService("ReplicatedStorage")
--Items
local fooPic = script.Parent
local AddValueEvent = repSto:WaitForChild("FoodPickupEvent")
--Process
local function FireServerWhenTouched (hit, plr)
if hit.Parent:FindFirstChild("Humanoid") then
fooPic:Destroy()
AddValueEvent:FireClient(plr)
end
end
--Conect
fooPic.Touched:Connect(FireServerWhenTouched)
--------------------------------------------------
this is local script inside player
--Declar
--GameServices
local player = game:GetService("Players").LocalPlayer
local pgui = player:WaitForChild("PlayerGui")
local repStore = game:GetService("ReplicatedStorage")
--RemoteEvent
local AddValueEvent = repStore:WaitForChild("FoodPickupEvent")
--PLayerGui
local sg = pgui:WaitForChild("ScreenGui")
local is = sg:WaitForChild("InStats")
local foodAmm = is:WaitForChild("FoodAmm")
local bp = player:WaitForChild("Backpack")
local isf = bp:WaitForChild("InvStats")
local accAmm = isf:WaitForChild("FoodAmm")
--Process
local function ChangeMessageWhenFired()
accAmm.Value = (accAmm.Value + 1)
foodAmm.Text = accAmm.Value
end
--Connect
AddValueEvent.OnClientEvent:Connect(ChangeMessageWhenFired)
thank you

2 comments
oh my; the code block did not work ;(
I fixed the code block lol