How to make the walkspeed not be bugged

local script inside tool:

local rem = game:GetService("ReplicatedStorage").RemoteEvent
local rem2 = game:GetService("ReplicatedStorage").rem2
local tool = script.Parent
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local humwalkspeed = hum.WalkSpeed
tool.Equipped:Connect(function()
	if hum.Health == 0 then return end
rem:FireServer()
end)

tool.Unequipped:Connect(function()
	if hum.Health == 0 then return end
rem2:FireServer(humwalkspeed)	
end)

normal script inside the tool:

local rem2 = game:GetService("ReplicatedStorage").rem2
rem2.OnServerEvent:Connect(function(plr,humwalkspeed)
	local char = plr.Character or plr.CharacterAdded:Wait()
	local hum = char:WaitForChild("Humanoid")
	hum.WalkSpeed =  humwalkspeed
end)

normal script inside the tool2:

local tool = script.Parent
local rem = game:GetService("ReplicatedStorage").RemoteEvent

rem.OnServerEvent:Connect(function(plr)
	local  char = plr.Character or plr.CharacterAdded:Wait()
	local hum = char:WaitForChild("Humanoid")

	hum.WalkSpeed =  32
end)

So when i equip the tool my walkspeed changes to 32 and when i unequip it it turns back to my original walkspeed which is 16 but if i reset and i equip the tool again it doesnt do anything which i dont want

You can make a script so whenever the player died, after some time, clone this tool from the ReplicatedStorage to the player backpack. Because when you reset your character, the script doesn’t know if your old character was equipping or not. So, yeah. :slightly_smiling_face:

1 Like

put it in the local script?
and wdym clone
do you mean this?
sample script:

hum.Died:Connect(function()
local clone = tool:Clone()
clone.Parent = game:GetService("ReplicatedStorage")
task.wait(0.002)

tool:Destroy()

player.CharacterAdded:Connect(function()
clone.Parent = game:GetService("StarterPack")

edit: i got it to work ayyy but…
how do i make the tool unlimited clone?

the new local script code:

local rem = game:GetService("ReplicatedStorage").RemoteEvent
local rem2 = game:GetService("ReplicatedStorage").rem2
local tool = script.Parent
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local humwalkspeed = hum.WalkSpeed

hum.Died:Connect(function()
	local clone = tool:Clone()
	clone.Parent = game:GetService("ReplicatedStorage")
	task.wait(0.002)

	tool:Destroy()
	plr.CharacterAdded:Connect(function()
		clone.Parent = game:GetService("StarterPack")
		print("hi")
end)
	end)
	
tool.Equipped:Connect(function()

rem:FireServer()
end)

tool.Unequipped:Connect(function()

rem2:FireServer(humwalkspeed)	
end)

Copy the tool the player spawns with and paste it in the replicated storage, and whenever the CharacterAdded event is fired, clone that tool from the replicated storage to the player Backpack and not the StarterPack.

1 Like