Hello developers, I’ve been searching around everywhere for this idea but can’t seem to find how to make it so basically I just want something when you use a tool It makes it so you cannot move.
Example of what I mean:
robloxapp-20220524-1653372.wmv (1.2 MB)
Thanks!
Just use the Tool.Equipped and change the walkspeed to 0. : |
This will disable the controls if the tool is Equipped
local plr = game:GetService("Players").LocalPlayer
local controls = require(plr.PlayerScripts.PlayerModule):GetControls()
local tool = script.Parent
tool.Equipped:Connect(function()
controls:Disable()
end)
4 Likes
It works fine but after my animation you can no longer move I want it so after a set amount of time you can move again and whenever I equip it I cant move I want it so when you click you cant move and then you can move again.
It is simple
You add a wait()
Controls:Enable()
1 Like
Oof I found another problem. In my other script It destroys the tool after I use it but when it destroys the player automatically moves around.
script:
local Debounce = false
local tool = script.Parent
tool.Activated:Connect(function()
if not Debounce then
Debounce = true
local humanoid = tool.Parent:FindFirstChild("Humanoid")
local Num = math.random(1,3)
if Num == 1 then
humanoid.Health += 25
elseif Num == 2 then
humanoid.WalkSpeed += 8
elseif Num == 3 then
humanoid.JumpPower += 10
end
wait(5)
tool:Destroy()
task.wait(999)
Debounce = false
end
end)
I don’t understand what you want to tell by “the player is moving around” can you detaliate it please?
So basically whenever the tool is destroyed in my script the player starts automatically walking when your not controlling it.
robloxapp-20220524-1810530.wmv (2.2 MB)
Did you try to deactivate the script and see if that is the problem? I mean to deactivate the scripts one by one after the tool is broken so you can find the faulty script
I have a hunch that it is not the scripts you sent us the ones that make this issue
I deactivated that script with the tool destroy and that’s the script thats causing the automatic walking when the tools destroyed.
What happens if you delete the lines after tool:Destroy()?
It may have no effect, but i don’t have any other ideas besides this one at the moment
Then if you delete tool:Destroy() it wouldn’t automatically walk around.
Not the tool Destroy, but
Task…wait, and debounce =false
Then it still would automatically run around.
Then i have no idea. Now I am just as confused as you are.
Oh, i just got an idea. What if you parent the tool to something else before destroying it. Does that help?
Im not quite sure how thats supposed to work.
Me neither, just try
Script.Parent = --something else than the character
Tool:Destroy()
Should I parent it to a part or something like that?
It still automatically walks when I parent it to a different part