I’m trying to make a shop GUI where you can buy stackable powerups.
I’ve made a button for JumpPower and WalkSpeed, made some scripts with help from tutorials
(scripts visible below)
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.BuyEvents.WalkSpeedEvent:FireServer()
end)
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.BuyEvents.jumpPowerEvent:FireServer()
end)
(Two events)
but then I couldn’t get it to give me the WalkSpeed Or JumpPower.
Then I made the server script… Well… Tried.
I tried a lot of stuff(which all horribly failed) and these are the ones I ended up with.
Yes, these.
game.ReplicatedStorage.BuyEvents.WalkSpeedEvent.OnServerEvent:Connect(function(player)
game.StarterPlayer.BuyPowerupWalkspeed.Disabled = false
end)
game.ReplicatedStorage.BuyEvents.jumpPowerEvent.OnServerEvent:Connect(function(player)
game.StarterPlayer.BuyPowerupJumpPower.Disabled = false
end)
local plr = game.Players:GetPlayerFromCharacter(player.Parent)
if player.leaderstats.Level.Value >= 10 then
player.leaderstats.Level.Value = player.leaderstats.Level.Value - 10
plr.Character.Humanoid.WalkSpeed = plr.Character.Humanoid.WalkSpeed +20
end
end)
local plr = game.Players:GetPlayerFromCharacter(player.Parent)
if player.leaderstats.Level.Value >= 10 then
player.leaderstats.Level.Value = player.leaderstats.Level.Value - 15
plr.Character.Humanoid.JumpPower = plr.Character.Humanoid.JumpPower +30
end
end)
I tried to make a script that lead to the other ones, depending on if you wanted Walkspeed or JumpPower.
2 big problems:
-
The script doesn’t work.
-
I still don’t precisely know how to change a player’s WalkSpeed/JumpPower.
I’ve searched on this devforum on how to fix it but I can’t…
I’m just a dum dum.
Problem video:
If any of you know how to fix this, please, help me!!!
-DarkeeDoo