0% found this document useful (0 votes)
29 views2 pages

Local PLR Game - Players.localplayefomfass

Uploaded by

thomasobungus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

Local PLR Game - Players.localplayefomfass

Uploaded by

thomasobungus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

local plr = game.Players.

LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()

local tool = script.Parent

local idleAnim = char:WaitForChild("Humanoid"):LoadAnimation(script.IdleAnim)


local forwardAnim = char:WaitForChild("Humanoid"):LoadAnimation(script.WalkAnim)
local LeftAnim = char:WaitForChild("Humanoid"):LoadAnimation(script.WalkAnim)
local RightAnim = char:WaitForChild("Humanoid"):LoadAnimation(script.WalkAnim)
local JumpAnim = char:WaitForChild(("Humanoid")):LoadAnimation(script.JumpAnim)
local ShootAnim = char:WaitForChild(("Humanoid")):LoadAnimation(script.ShootAnim)

local wPressed = false


local sPressed = false
local aPressed = false
local dPressed = false
local spPressed = false

local uis = game:GetService("UserInputService")

local equipped = false

tool.Equipped:Connect(function()

game.ReplicatedStorage.ConnectM6D:FireServer(tool.BodyAttach)

char.Torso.ToolGrip.Part0 = char.Torso
char.Torso.ToolGrip.Part1 = tool.BodyAttach

equipped = true
idleAnim:Play()
end)

tool.Unequipped:Connect(function()

game.ReplicatedStorage.DisconnectM6D:FireServer()

equipped = false
idleAnim:Stop()
forwardAnim:Stop()
LeftAnim:Stop()
RightAnim:Stop()
JumpAnim:Stop()
end)

tool.Activated:Connect(function()
ShootAnim:Play()
wait(3)
ShootAnim:Stop()
end)

uis.InputBegan:Connect(function(key, chat)
if equipped then
if chat then return end
if key.KeyCode == Enum.KeyCode.W and equipped == true then
wPressed = true
forwardAnim:Play()
elseif key.KeyCode == Enum.KeyCode.S and equipped == true then
sPressed = true
forwardAnim:Play()
elseif key.KeyCode == Enum.KeyCode.A and equipped == true then
aPressed = true
LeftAnim:Play()
elseif key.KeyCode == Enum.KeyCode.D and equipped == true then
dPressed = true
RightAnim:Play()
elseif key.KeyCode == Enum.KeyCode.Space and equipped == true then
spPressed = true
JumpAnim:Play()
end
end

end)

uis.InputEnded:Connect(function(key, chat)
if chat then return end
if key.KeyCode == Enum.KeyCode.W then
wPressed = false
forwardAnim:Stop()
elseif key.KeyCode == Enum.KeyCode.S then
sPressed = false
forwardAnim:Stop()
elseif key.KeyCode == Enum.KeyCode.A then
aPressed = false
LeftAnim:Stop()
elseif key.KeyCode == Enum.KeyCode.D then
dPressed = false
RightAnim:Stop()
elseif key.KeyCode == Enum.KeyCode.Space then
spPressed = false
JumpAnim:Stop()
end
end)

You might also like