I have a remote event that fires to the client and i'm trying to fire the player but for some reason the player is taking the role of the numberamnt
local box = script.Parent
local stat = game.ReplicatedStorage.Remote.StatUpd
local function PlayerTouched(Part)
local Parent = Part.Parent
if game.Players:GetPlayerFromCharacter(Parent) then
local plr = game.Players[Parent.Name]
local moneyamnt = math.random(200,400)
stat:FireClient(plr, moneyamnt)
end
end
box.Touched:connect(PlayerTouched)
^^^ The script firing the client (Not a local script)
local stat = game.ReplicatedStorage.Remote.StatUpd
stat.OnClientEvent:Connect(function(plr, moneyamnt)
plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + moneyamnt.Value
end)
^^^ The script receiving what the client fires

3 comments
Well the reason I did this is because I can't seem to use onTouched in a LocalScript
You shouldn’t be.
use game.Players.LocalPlayer.leaderstats