-
What do you want to achieve?
A Fix For This “Glitch” -
What is the issue? Include screenshots / videos if possible!
Cant Use The Tool When Crouched. - What solutions have you tried so far? Did you look for solutions on the Developer Hub? No. i didnt found nothing the Forum.
My Crouch Script:
local player = game.Players.LocalPlayer
local button = player.PlayerGui.MobileAgachar.Template
local UI = game:GetService(“UserInputService”)
local Humanoid = script.Parent:WaitForChild(“Humanoid”)
local ParadoAgachado = Humanoid:LoadAnimation(script:WaitForChild(“Parado”))
local AndarAgachado = Humanoid:LoadAnimation(script:WaitForChild(“Andando”))
local Crouch = false
local function toggleAnimation()
if not Crouch then
if Humanoid.MoveDirection.Magnitude == 0 then
ParadoAgachado:Play()
else
AndarAgachado:Play()
end
Humanoid.WalkSpeed = 8
Humanoid.JumpPower = 30
Crouch = true
else
ParadoAgachado:Stop()
AndarAgachado:Stop()
Humanoid.JumpPower = 50
Humanoid.WalkSpeed = 20.04
Crouch = false
end
end
local controlPressed = false
button.MouseButton1Down:Connect(function()
controlPressed = true
end)
button.MouseButton1Up:Connect(function()
controlPressed = false
end)
UI.InputBegan:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent and input.KeyCode == Enum.KeyCode.LeftControl then
controlPressed = true
end
end)
UI.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftControl then
controlPressed = false
end
end)
game:GetService(“RunService”).Stepped:Connect(function()
if controlPressed then
if not Crouch then
toggleAnimation()
end
else
if Crouch then
toggleAnimation()
end
end
if Crouch then
if Humanoid.MoveDirection.Magnitude > 0 and not AndarAgachado.IsPlaying then
ParadoAgachado:Stop()
AndarAgachado:Play()
elseif Humanoid.MoveDirection.Magnitude == 0 and AndarAgachado.IsPlaying then
AndarAgachado:Stop()
ParadoAgachado:Play()
end
end
end)
– my tool script
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local MAX_DISTANCE = 30
script.Parent.Activated:Connect(function()
local target = mouse.Target
local distance = (target.Position - player.Character.HumanoidRootPart.Position).Magnitude
if distance <= MAX_DISTANCE then
script.Parent.som:Play()
game.ReplicatedStorage.PartPlaced:FireServer(mouse.TargetSurface, target.Position)
else
print("nao da pra bota bloco longe lkjkjkjk.")
end
end)
mouse.Move:Connect(function()
if player.Character:FindFirstChild(“Blocks”) then
if mouse.Target.Name == “Block” then
local NewBlock = script.PreviewBlock:Clone()
NewBlock.Parent = mouse.Target
game.Workspace.PreviewBlocks:ClearAllChildren()
if mouse.TargetSurface == Enum.NormalId.Top then
NewBlock.Parent = workspace.PreviewBlocks
NewBlock.Position = mouse.Target.Position + Vector3.new(0,4,0)
elseif mouse.TargetSurface == Enum.NormalId.Left then
NewBlock.Parent = workspace.PreviewBlocks
NewBlock.Position = mouse.Target.Position + Vector3.new(-4,0,0)
elseif mouse.TargetSurface == Enum.NormalId.Right then
NewBlock.Parent = workspace.PreviewBlocks
NewBlock.Position = mouse.Target.Position + Vector3.new(4,0,0)
elseif mouse.TargetSurface == Enum.NormalId.Bottom then
NewBlock.Parent = workspace.PreviewBlocks
NewBlock.Position = mouse.Target.Position + Vector3.new(0,-4,0)
elseif mouse.TargetSurface == Enum.NormalId.Back then
NewBlock.Parent = workspace.PreviewBlocks
NewBlock.Position = mouse.Target.Position + Vector3.new(0,0,4)
elseif mouse.TargetSurface == Enum.NormalId.Front then
NewBlock.Parent = workspace.PreviewBlocks
NewBlock.Position = mouse.Target.Position + Vector3.new(0,0,-4)
end
end
end
end)
script.Parent.Unequipped:Connect(function()
game.Workspace.PreviewBlocks:ClearAllChildren()
end)