I have a tool “Speed” and when you click it you gain speed which makes your character faster but im having a few problems.
I want it so when you click the sped tool you gain 0.25 speed and when you rebirth it doubles that amount each rebirth.
problem 1) speed is not going up
problem 2) I don’t know how to script the rebirth part
problem 3) when a player dies and respawns their speed is set to normal until they click the speed tool again
problem 4) when a player dies and respawns i get this error - “LoadAnimation requires the Humanoid object (ItzSulfonic.Humanoid) to be a descendant of the game object” inside the tool’s script
This is the serverscript when the tool is clicked
local event = game.ReplicatedStorage:WaitForChild("AddSqa")
event.OnServerEvent:Connect(function(player)
local Stats = player:WaitForChild("leaderstats")
local speed = Stats:FindFirstChild("speed")
local rb = Stats:FindFirstChild("rebirths")
local gain = 1 / 4
local char = player.Character or player.CharacterAdded:wait()
if char then
local hum = char:FindFirstChild("Humanoid")
if hum then
speed.Value = speed.Value + gain
hum.WalkSpeed = speed.Value / 2.5
end
end
end)
This is the script inside the tool that fires the event and where im having problem 4.
local db = false
local Tool = script.Parent
local Plr = game.Players.LocalPlayer
local Char = Plr.Character or Plr.CharacterAdded:Wait()
local Humanoid = Char:WaitForChild("Humanoid")
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://6656875234"
local track = Humanoid:LoadAnimation(Anim)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("AddSqa")
Tool.Activated:Connect(function()
if db == false then
track:Play()
db = true
remoteEvent:FireServer()
delay(1, function()
db = false
end)
wait(10)
end
end)