I am creating a knife system similar to MM2. However, I am working on console compatibility and cannot seem to get the knife to throw on console. I have tried searching on YT and deconstructing free models, but they all only work on pc.The code is below. Any help is appreciated.
Thanks Farmboy014
print("ConsoleThrow")
local Knife = plr.Character:FindFirstChild("Knife"):FindFirstChild("Handle"):Clone()
Knife.Parent = workspace
Knife.Name = plr.Name.."'s Knife"
local sound = Instance.new("Sound",Knife)
sound.SoundId = ThrowSound
sound:Play()
local character = plr.Character
local HRP = character:WaitForChild("HumanoidRootPart")
local Direction = (HRP.CFrame.LookVector + HRP.CFrame.UpVector) * 100
local VF = Instance.new("VectorForce",Knife)
local Attach = Instance.new("Attachment",Knife)
VF.Attachment0 = Attach
VF.ApplyAtCenterOfMass = true
VF.RelativeTo = Enum.ActuatorRelativeTo.World
VF.Enabled = true
VF.Force = Direction
So it’s not a problem with the part of the script handling the knife if it works for pc, so could I see the part where you actually get the users input and call the function?
--The control script
elseif Key.KeyCode == Enum.KeyCode.ButtonL2 then
ThrowKnife(Tool)
end
--Function
local function ThrowKnife(tool)
if debounce then return end
if UIS.KeyboardEnabled == true then
ThrowEvent:FireServer(Player:GetMouse().Hit,"Throw","PC")
elseif UIS.GamepadEnabled == true then
ThrowEvent:FireServer(nil,"Throw","Console")
end
end