Hello everyone,
I have this problem with the move I am working on that includes some teleportation. While making the hitbox I found this problem where the hitbox is on the wrong CFrame when moving and sometimes even without moving.
Watch Bug1 | Streamable (idk why streamable is doing this sorry)
This is the code for the move :
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local RemoteEvent = ReplicatedStorage.Events.Remote.ThunderClapRemote
local TweenService = game:GetService("TweenService")
local Player = game:GetService("Players")
local debounce = false
RemoteEvent.OnServerEvent:Connect(function(player)
if debounce == true then
return
end
debounce = true
local HumanoidRootPart = player.Character:FindFirstChild("HumanoidRootPart")
local Startpos = HumanoidRootPart.CFrame
local hitbox = Instance.new("Part")
hitbox.Parent =workspace.Map
hitbox.Color = Color3.new(1, 0, 0)
hitbox.CanCollide = false
hitbox.Transparency = 0.8
hitbox.Anchored = true
hitbox.Size = Vector3.new(12,5,50)
hitbox.CFrame = HumanoidRootPart.CFrame + Vector3.new(0,0,-30)
local function MakeCount()
for count = 1 ,5 do
local X
local countfolder = {}
local part = Instance.new("Part")
if count % 2 == 0 then
X = -6
else
X = 6
end
part.Parent = game.Workspace
part.Anchored = true
part.CanCollide = false
part.Transparency = 1
part.Size = Vector3.new(1,1,1)
part.CFrame = Startpos * CFrame.new(0 + X,0,-count * 10)
player.Character:MoveTo(part.Position)
wait(0.1)
part:Destroy()
end
end
task.spawn(MakeCount)
task.wait(MakeCount())
hitbox:Destroy()
wait(3)
debounce = false
end)
Thanks for helping!