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

Why wont my currency Exchange System work?

Asked by 3 years ago

I'm currently working on a currency exchange system that is ran by 2 scripts and you just put the amount you want to exchange and you click a button and when that happens it fires an even sending the player and the amount the player wants to receive and in the script that does that I have a Variable that holds a value calculated from doing this equation Receiving.Value * 1000, but it doesn't do that and I get the error Value is not a valid member of Player "Players.vincentthecat1.

--###----------[[FIRESEVENT]]----------###--

ExchangeButton.MouseButton1Down:Connect(function()
    ExchangeEvent:FireServer(Player, Receiving)
end)

--###----------[[COLLECTSDATA]]----------###--

ExchangeEvent.OnServerEvent:Connect(function(Player, Receiving)
local Cost = Receiving.Value * 1000 --The Line the error comes from.
    if Player.leaderstats.Bux.Value >= Cost then
        Player.leaderstats.Bux.Value -=Cost
        Player.leaderstats.Gems.Value +=Receiving
    end
end)

1 answer

Log in to vote
1
Answered by 3 years ago

When you fire server, the player argument is automatically sent in already so you dont have to do it. Just remove Player argument when doing :FireServer()

ExchangeEvent:FireServer(Receiving)
0
I forgot about that this has to be the dumbest moment in my entire life lol anyways thanks for the help! vincentthecat1 199 — 3y
0
I fixed the error but nothing happens now vincentthecat1 199 — 3y
0
Okay I fixed it. vincentthecat1 199 — 3y
Ad

Answer this question