I wrote this script that makes the player jump when they are touching a part, it only makes the player jump sometimes and I’d like them to jump all the time. I think that the issue might be the touched event but I am not 100% sure, as the player does touch the part but it doesn’t print sometimes.
for _, fanParts in pairs(CS:GetTagged("FanPart")) do
fanParts.Touched:Connect(function(touched)
print("tocuhed")
if fanParts.Direction.Value == "Right" then
RS.RE.VectorForce:FireServer("Right")
print("vc fired")
elseif fanParts.Direction.Value == "Left" then
RS.RE.VectorForce:FireServer("Left")
elseif fanParts.Direction.Value == "Up" then
RS.RE.VectorForce:FireServer("Up")
end
end)
RE.VectorForce.OnServerEvent:Connect(function(player, direction)
print("fired vecotr")
local HumanoidRP = player.Character:FindFirstChild("HumanoidRootPart")
local vectorForce = HumanoidRP.VectorForce
local Attachment = HumanoidRP.Attachment
--vectorForce.Parent = player.Character.HumanoidRootPart
vectorForce.RelativeTo = "Attachment0"
vectorForce.Attachment0 = HumanoidRP.Attachment
--Debris:AddItem(Attachment,100)
vectorForce.ApplyAtCenterOfMass = false
if direction == "Up" then
print("up")
HumanoidRP.VectorForce.Force = Vector3.new(0, 1800, 0)
--if player.Character.Humanoid.Jump == false then
-- print("false")
player.Character.Humanoid.Jump = true
--end
elseif direction == "Right" then
HumanoidRP.VectorForce.Force = Vector3.new(6000, 0, 0)
elseif direction == "Left" then
HumanoidRP.VectorForce.Force = Vector3.new(-6000, 0, 0)
end
end)
If anyone has any suggestions please let me know