Ok I want to make a platform where you sell your items for money. However while making the touch thingy, it works in studio. However in the game, when I walk on it, it shows an error. ireClient player argument must be a player object - Here are the 2 scripts. Does anyone know any problems?
SERVER SCRIPT
script.Parent.Touched:connect(function(part)
local plr = part.Parent
game.ReplicatedStorage.Events.SellGrass:FireClient(plr)
end)
LOCALSCRIPT
local leaderstats = game.Players.LocalPlayer:WaitForChild("leaderstats")
game.ReplicatedStorage.Events.SellGrass.OnClientEvent:connect(function(plr) -- Change if event is in different area
leaderstats.Money.Value = leaderstats.Money.Value + leaderstats.Grass.Value
leaderstats.Grass.Value = 0
end)

1 comment
Well it did lol. Anyways I found out that plr.Parent just gets its character, so I learned the GetPlayerFromCharacter. It ends up working.