Hello! It’s me again!
I can’t seem to get the keyboard/gamepad part of this to work.
The keys don’t even get detected, on both my XBOX One gamepad and keyboard.
--call objects--
local IceBalloon = script.Parent.Parent.Model.MeshPart
local IceTrig = script.Parent
local Attach = script.Parent.Parent.Model.ee.Attachment1
local IDLE_SWING = script.Parent.Parent.ANIMS.Animation
local defaultGravity = 196.2
local SwingGravity = 55
local UserInputService = game:GetService("UserInputService")
--end of calling objects--
--script start--
local function PlayerTouched(Part)
local Parent = Part.Parent
if game.Players:GetPlayerFromCharacter(Parent) then
workspace.Gravity = SwingGravity
Parent.Archivable = true
local PLY_ATTACH = Instance.new("Attachment")
PLY_ATTACH.Parent = Parent.Head
local CREATE_ROPE = Instance.new("RopeConstraint")
CREATE_ROPE.Attachment0 = PLY_ATTACH
CREATE_ROPE.Attachment1 = Attach
CREATE_ROPE.Length = 10
CREATE_ROPE.Restitution = 0.2
CREATE_ROPE.Parent = Parent.Head
CREATE_ROPE.Thickness = 0.5
CREATE_ROPE.Visible = true
CREATE_ROPE.Color = BrickColor.new("Carnation pink")
local Play_IDLE_SWING = Parent.Humanoid:LoadAnimation(IDLE_SWING)
Play_IDLE_SWING:Play()
IceTrig.Size = Vector3.new(0.2, 0.2, 0.2)
--CHECK FOR XBOX INPUTS--
UserInputService.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Gamepad1 then
if input.KeyCode == Enum.KeyCode.ButtonA then
--PLAYER EXIT SWING STATE--
CREATE_ROPE:Destroy()
workspace.Gravity = defaultGravity
PLY_ATTACH:Destroy()
--END OF XBOX--
--CHECK FOR PC INPUTS--
local function onInputBegan(input, gameProcessed)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.Space then
--PLAYER EXIT SWING STATE--
print("test")
CREATE_ROPE:Destroy()
workspace.Gravity = defaultGravity
PLY_ATTACH:Destroy()
--END OF PC--
end
end
end
end
end
end)
end
end
script.Parent.Touched:connect(PlayerTouched)