Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago
Edited 5 years ago

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

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

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.

0
Yeah. Thanks. kittonlover101 201 — 5y
Ad
Log in to vote
1
Answered by 5 years ago

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.

0
???? User#24403 69 — 5y
0
????? namespace25 594 — 5y

Answer this question