Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[SOLVED] Why is transferring int values over a RemoteEvent not working?

The title explains literally everything.

Here are my scripts:

Here is where I set the 'pricer' var.

LOCAL SCRIPT:

pricer = 20000

LOCAL SCRIPT:

game.ReplicatedStorage.IntPurcEvent:FireServer(player, pricer)

SCRIPT:

rs.IntPurcEvent.OnServerEvent:Connect(function(player, pricer)
    player.leaderstats.Money.Value = player.leaderstats.Money.Value - pricer
end)

ERROR I RECEIVE IN CONSOLE:

18:58:35.796 - Workspace.ClientReqScript:35: attempt to perform arithmetic on local 'pricer' (a userdata value)

Thanks for any help!

EDITS:

I WILL NOT DO THIS:

player.leaderstats.Money.Value = player.leaderstats.Money.Value - 20000

BECAUSE PRICER CAN BE MULTIPLE VALUES

2 answers

✓ Accepted answer

Remove the first parameter ('player') when firing the event. When using FireServer in a localscript, your player get's automatically passed in as the first argument, so what you're doing is making the second argument (Which is supposed to be price.) the player again.

1 comment

0

Yeah. Thanks.

I think this is the problem:

local pricer.Value = 20000

That should work. I think you attempted to call an int value, not the actual value of it.

2 comments

0

????

0

?????

This discussion is preserved as it was. New answers, comments, and votes are closed.