Wassup! I’m trying to make Sonic.EXE for a project of mine, and one of his moves is he disappears into fog and teleports behind the player. However, that is not working for me. It just teleports me slightly to my right/left
I have tried looking around for fixes, but to no avail.
Code:
teleport_exe.OnServerEvent:Connect(function(player)
local character = player.Character
if not character then return end
local humanoid_root = character:WaitForChild("HumanoidRootPart")
local humanoid = character:WaitForChild("Humanoid")
local fog = game.ServerStorage.STORAGE.PARTICLES.FOG_PARTICLE:Clone()
fog.Parent = humanoid_root
DEBRIS:AddItem(fog, 8)
local ray_params = RaycastParams.new()
ray_params.FilterType = Enum.RaycastFilterType.Blacklist
ray_params.FilterDescendantsInstances = {character}
local origin = humanoid_root.Position
local direction = humanoid_root.CFrame.LookVector * 1000
local raycast_result = workspace:Raycast(origin, direction)
if raycast_result and game.Players:GetPlayerFromCharacter(raycast_result.Instance.Parent) then
fog:Emit(40)
local other_hrp:BasePart = raycast_result.Instance.Parent.HumanoidRootPart
humanoid_root.CFrame = other_hrp.CFrame + Vector3.new(-3,0,0)
end
end)
Edit: I said to add a blacklist filter and removed that because I saw that you had one, but I now realize that you just didn’t add the ray params to your raycast so I was correct lol.