Me and @earthyviking92 (his main is @logbot22) are working on a game named Gym Simulator. That is aside from the point, I have a bench press in the game and here is the script:
local Tool = script.Parent
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://10556543684"
local track
script.Parent.Triggered:Connect(function(plr)
script.Parent.Parent:Sit(plr.Character.Humanoid)
track = plr.Character.Humanoid:LoadAnimation(Anim)
track.Priority = Enum.AnimationPriority.Action
track.Looped = false
plr.leaderstats.Stars.Value = plr.leaderstats.Stars.Value +3
track:Play()
end)
And here is a video of me getting “Stars” As me and @logbot22 like to call our leaderstats value and then it completely resetting.
The way I got “Stars” Before was I used the weight. The script inside the weight is:
local Tool = script.Parent
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://10546931590"
local track
Tool.Equipped:Connect(function(Mouse)
Mouse.Button1Down:Connect(function()
if game.Players.LocalPlayer.Energy.Value >5 then
game.Players.LocalPlayer.Energy.Value = game.Players.LocalPlayer.Energy.Value -5
track = script.Parent.Parent.Humanoid:LoadAnimation(Anim)
track.Priority = Enum.AnimationPriority.Action
track.Looped = false
game.Players.LocalPlayer.leaderstats.Stars.Value = game.Players.LocalPlayer.leaderstats.Stars.Value +5
track:Play()
wait(5)
-- script.Parent.Parent.Humanoid.WalkSpeed = 16
else
game.Players.LocalPlayer.PlayerGui.Alert.TextLabel.Visible = true
game.Players.LocalPlayer.PlayerGui.Alert.TextLabel.Text = "You have 0 energy. Please go to a cafe to get some coffee and fill up your energy!"
wait(3)
game.Players.LocalPlayer.PlayerGui.Alert.TextLabel.Visible = false
end
end)
end)
Tool.Unequipped:Connect(function()
if track then
track:Stop()
end
end)
Any Feedback is appreciated! Thank you.