So i have a script here that fires my fireball. But i want to make it so it stops the players movement when they press r to fire it. So how could i go about doing that?
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local RemoteEvent = game.Workspace.Fired local UIS = game:GetService("UserInputService") local Debounce = false UIS.InputBegan:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.R then wait(0.5) if Debounce == true then return end RemoteEvent:FireServer(Debounce) end end)
You could anchor the character's torso before you perform your wait(0.5)
, then unanchor it afterwards.
UIS.InputBegan:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.R then if Debounce == true then return end -- anchor torso here wait(0.5) -- unanchor torso here RemoteEvent:FireServer(Debounce) end end)
To make the player stop moving, you would need to configure with their character.
A method would be to temporarily make the Humanoid's Walkspeed to 0 and back to normal speed.
If you don't want the player to jump, you can also set the Humanoid's JumpPower to 0 and back to its original.
This can be done in the Server Script you linked to the RemoteEvent if this is Filtering Enabled.