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

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

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

✓ Accepted answer

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

4 comments

0

Also, don`t handle it on client side, learn about remote events to successfuly make the transaction

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.

0

+blockmask Im just gonna put it to the side instead, no idea what you meant really lol. But thanks for the response anyways.

0

....No problem

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