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

I'm making a button that gives the player jumpboost but it dosen't work?

Asked by 5 years ago
Edited 5 years ago

Info/setup of button: https://i.postimg.cc/WbFd0zxg/Info.png It's also not displaying if you don't have enough money or if it was purchased etc. It does give you the jumpboost even if you don't have "Coins" for it for some reason?

the code for the button:

 player = game.Players.LocalPlayer

 script.Parent.MouseButton1Click:Connect(function()

 if player.Character.Humanoid.JumpPower == 65 then

 script.Parent.Text "Already Bougth!"

 if player:FindFirstChild("leaderstats") then

 if player.leaderstats.Coins.Value == 10 then

 player.leaderstats.Coins.Value = player.leaderstats.Coins.Value -10

 script.Parent.Text = "Purchased"

 player.Character.Humanoid.JumpPower = 65

 elseif player.leaderstats.Coins.Value >= 10 then

 script.Parent.Text = "Not enough money!"

 end

 end

 end

 end)

my leaderstats (extra info):

game.Players.PlayerAdded:connect(function(plr)

local stats = Instance.new("BoolValue",plr)

stats.Name = "leaderstats"

local Coins = Instance.new("IntValue",stats)

Coins.Name = "Coins"

Coins.Value = 0

end)

1 answer

Log in to vote
0
Answered by
blockmask 374 Moderation Voter
5 years ago

Ok, first of all. You're not setting the coins value to 10 in the beginning, second of all. Since that script is on the client and client can change anything, do game:GetService("Players").LocalPlayer.

Third, you checked to see if a player's coins are equal to 10,but keep in mind that player's that are more richer can't buy it, simply change it to >=10

And in the bottom, simply change it to <10

0
Also, don`t handle it on client side, learn about remote events to successfuly make the transaction blockmask 374 — 5y
0
Yeah, I have no idea why you would use the greater than sign to check if the amount of money is not enough. Lol. Good point. DeceptiveCaster 3761 — 5y
0
+blockmask Im just gonna put it to the side instead, no idea what you meant really lol. But thanks for the response anyways. Freddan2006YT 88 — 5y
0
....No problem blockmask 374 — 5y
Ad

Answer this question