- What do you want to achieve? Keep it simple and clear!
I want to make my character run when he click with a script in the server side.
- What is the issue? Include screenshots / videos if possible!
The code work sometime and it had no error !!
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I don’t know what to do but I think the solution is with RunService but I don’t understand how to use it.
Sorry for my English, I’m French.
Thanks for the time you have take to reading this.
Here my code
In a localscript which is in a Tool
local Player = game.Players.LocalPlayer
local Tool = script.Parent
local Mouse = Player:GetMouse()
local EquipperToolFantome1 = false
local EquipperToolFantome2 = false
Tool.Equipped:Connect(function()
EquipperToolFantome1 = true
EquipperToolFantome2 = true
end)
Tool.Unequipped:Connect(function()
EquipperToolFantome1 = false
EquipperToolFantome2 = false
end)
Mouse.Button1Down:Connect(function()
if EquipperToolFantome1 == true and EquipperToolFantome2 == true then
EquipperToolFantome1 = false
game.ReplicatedStorage.RemoteEvent:FireServer(Tool)
wait(2.5)
EquipperToolFantome1 = true
end
end)
In a script which is in SeverScriptService
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player, Tool)
local EquipperToolFantome1 = true
local EquipperToolFantome2 = true
Tool.Equipped:Connect(function()
EquipperToolFantome1 = true
EquipperToolFantome2 = true
end)
Tool.Unequipped:Connect(function()
EquipperToolFantome1 = false
EquipperToolFantome2 = false
end)
if EquipperToolFantome1 == true and EquipperToolFantome2 == true then
EquipperToolFantome1 = false
player.Character.Humanoid.WalkSpeed = 25
wait(1)
player.Character.Humanoid.WalkSpeed = 16
wait(1.5)
EquipperToolFantome1 = true
end
end)