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

How do I make an exchange leaderstats gui button?

Asked by 4 years ago

Can someone tell me how to make an exchange leaderstats gui because I need it for my Halloween game. Ill tell an example.

Someone has 5 candy then they click a button and they lose 5 candy and get 10 money.

2 answers

Log in to vote
0
Answered by
sheepposu 561 Moderation Voter
4 years ago
Edited 4 years ago

This is just a simple matter of manipulating instance values and designing the GUI. First design the GUI, open button, close button, the frame, button to click on, labels, all of that. Use a LocalScript in the button, then a RemoteEvent to send a signal to a server script in ServerScriptService that will detect the event and make the change. Here are some code examples

Local Script

local plr = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.Events.EventName:FireServer()
end)

Server script

game.ReplicatedStorage.Events.EventName.OnServerEvent:Connect(function(plr)
    --Make the exchange here
end)

Hope this helps

0
Idk how to make the exchange though because I asked how to make the button exchange not how to make it filtering enabled comptatible Sp00ked1 6 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

What you would do is when a player clicks a button, you would fire a remote event when the button is clicked, and recieve that remote event on a server script, then perhaps saying something like :

if player.leaderstats.candy.Value >= 5 then
    player.leaderstats.candy.Value = player.leaderstats.candy.Value - 5
    player.leaderstats.money.Value = player.leaderstats.money.Value + 10
end

Answer this question