RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"if right click when player holds a tool ,stop player from moving"
-- local script inside the tool local tool = script.Parent local player = game.Players.LocalPlayer local mouse = player:GetMouse() local function stopMovement() if tool:IsDescendantOf(player.Backpack) or tool:IsDescendantOf(player.Character) then player.Character.Humanoid.WalkSpeed = 0 end end local function resumeMovement() if tool:IsDescendantOf(player.Backpack) or tool:IsDescendantOf(player.Character) then player.Character.Humanoid.WalkSpeed = 16 end end mouse.Button2Down:Connect(stopMovement) mouse.Button2Up:Connect(resumeMovement)