Hi! I need help in converting this localscript into a normal script:
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local uis = game:GetService("UserInputService")
local movingpart = workspace.Union
local tool = script.Parent
local inputConnection
local isEquipTool = false
script.Parent = game:GetService("Players").LocalPlayer:WaitForChild("PlayerScripts")
uis.InputBegan:Connect(function(input, gameProcessedEvent)
if not isEquipTool then return end
if not gameProcessedEvent then return end
if input.KeyCode == Enum.KeyCode.Left then
movingpart.Position = movingpart.Position + Vector3.new(0, 0, -1)
print("Moving part left")
elseif input.KeyCode == Enum.KeyCode.Right then
movingpart.Position = movingpart.Position + Vector3.new(0, 0, 1)
print("Moving part right")
end
end)
tool.Equipped:Connect(function()
isEquipTool = true
end)
tool.Unequipped:Connect(function()
isEquipTool = false
end)