Hello there.
I have a problem in the Module called FastCast.
My problem is that the RayCast hits the Character but i told it not to.
Heres the Code:
local UserInputService = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Mouse = player:GetMouse()
local MagmaModule = require(game.ReplicatedStorage.MagmaModule)
local MagmaMovesModule = require(game.ReplicatedStorage.MagmaMoves)
local FastCastRedux = require(game.ReplicatedStorage:WaitForChild("FastCastRedux"))
FastCastRedux.VisualizeCasts = true
local MagmaFistProjectile = FastCastRedux.new()
local Move = false
local debounce = false
local Holding = false
local ready = false
local coolDown = 1
local MaxDistance = 50
local ProjectileSpped = 120
local ProjectileDrop = -20
local CastParams = RaycastParams.new()
CastParams.FilterType = Enum.RaycastFilterType.Blacklist
CastParams.IgnoreWater = true
local FastCastParams = FastCastRedux.newBehavior()
FastCastParams.Acceleration = Vector3.new(0, ProjectileDrop, 0)
FastCastParams.AutoIgnoreContainer = false
FastCastParams.RayCastParams = CastParams
local BeginHold = Humanoid:LoadAnimation(script.BeginHold)
local Hold = Humanoid:LoadAnimation(script.Hold)
local Punch = Humanoid:LoadAnimation(script.Punch)
UserInputService.InputBegan:Connect(function(Input, IsTyping)
if not IsTyping and Input.KeyCode == Enum.KeyCode.E and Holding == false then
Holding = true
Move = true
BeginHold:Play()
BeginHold:AdjustSpeed(3)
BeginHold.Stopped:Connect(function()
ready = true
Hold:Play()
end)
end
end)
UserInputService.InputEnded:Connect(function(Input, IsTyping)
if not IsTyping and Input.KeyCode == Enum.KeyCode.E and Holding == true and debounce == false then
debounce = true
if ready == true then
Hold:Stop()
Punch:Play()
Punch:AdjustSpeed(3)
else
repeat wait() until ready == true
Hold:Stop()
Punch:Play()
Punch:AdjustSpeed(3)
end
local Origin = Character.HumanoidRootPart.Position
local Direction = (Mouse.Hit.p - Origin).Unit
CastParams.FilterDescendantsInstances = {Character}
MagmaFistProjectile:Fire(Origin, Direction, ProjectileSpped, FastCastParams)
MagmaFistProjectile.RayHit:Connect(function(cast, result, velocity, bullet)
print(result)
end)
Move = false
wait(coolDown)
debounce = false
Holding = false
ready = false
end
end)
while wait(0.1) do
if Move == true then
MagmaModule.MagmaInHand({Character.RightUpperArm, Character.RightLowerArm, Character.RightHand})
wait()
MagmaModule.MagmaDrop({Character.RightUpperArm, Character.RightLowerArm, Character.RightHand})
wait(math.random(0.5, 2))
end
end
Is there a problem in my code?
Any suggestion whould be greatly appreciated!