Hello, i’ve been researching for days but i didnt found anything, heres an attempt i made :
repeat
moverPart.Position = plr.Character:WaitForChild("HumanoidRootPart").Position + plr.Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 7
wait(0.08)
until moverPart.Touched:Connect(function()
1 Like
I don’t think you quite understand how events work.
It should look more something like this.
local humanoidRootPart = plr.Character:WaitForChild("HumanoidRootPart")
local touched = false
moverPart.Touched:Once(function()
touched = true
end)
while not touched do
moverPart.Position = humanoidRootPart.Position + humanoidRootPart.CFrame.LookVector * 7
task.wait(.08)
end
I have not tested this, the rest is up to you again.
It looks the same as my old code, even when the part touches something, also could you Help me fix the part backing away problem? Right now it just looks like its welded to the hrp when i move
1 Like
Bumping this because i need help
1 Like
i think you can do is,
while task.wait() do
moverPart.Position = plr.Character:WaitForChild("HumanoidRootPart").Position + plr.Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 7
moverPart.Touched:Connect(function()
break
end)
end
Also for the “While task.wait()” part you can add what number you want in the “()”
wait my bad, a mistake, let me fix it
Yeah the same as my code happens, Also thank You
1 Like
Maybe i almost must mention that all of this happens in an Animation.Stopped event (This is for a throw attack, i welded a part to the enemy)
1 Like
oh, well im kinda bad at that, but i did use roblox assistant to make a raycast system (i advice for you to also use roblox assistance) here is the code with a bit of modified changes
local moverPart = script.Parent
local rayDirection = Vector3.new(1, 0, 0)
local rayLength = 1
local function isNormalPart(hit)
if hit:IsA("Part") then
local parent = hit.Parent
if parent:FindFirstChildOfClass("Humanoid") then
return false
else
return true
end
end
return false
end
while true do
task.wait()
moverPart.Position = (Switch with the part position system) + rayDirection * 1
local rayOrigin = moverPart.Position
local raycastResult = workspace:Raycast(rayOrigin, rayDirection * rayLength)
if raycastResult then
local hitPart = raycastResult.Instance
if isNormalPart(hitPart) then
print("Detected a normal part: " .. hitPart.Name)
break
end
end
end
Whats the part position System?
1 Like
moverPart.Position = plr.Character:WaitForChild(“HumanoidRootPart”).Position + plr.Character:WaitForChild(“HumanoidRootPart”).CFrame.LookVector * 7
I got an error Position is not a valid member of ServerScriptService "ServerScriptService"
1 Like
can i see the entire script please?
GettingThrownAnimation.Stopped:Connect(function()
FlyingBackwards:Play(0.00000000001)
local moverPart = script.Parent
local rayDirection = Vector3.new(1, 0, 0)
local rayLength = 1
local function isNormalPart(hit)
if hit:IsA("Part") then
local parent = hit.Parent
if parent:FindFirstChildOfClass("Humanoid") then
return false
else
return true
end
end
return false
end
while true do
task.wait()
moverPart.Position = plr.Character:WaitForChild("HumanoidRootPart").Position + plr.Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 7 + rayDirection * 1
local rayOrigin = moverPart.Position
local raycastResult = workspace:Raycast(rayOrigin, rayDirection * rayLength)
if raycastResult then
local hitPart = raycastResult.Instance
if isNormalPart(hitPart) then
print("Detected a normal part: " .. hitPart.Name)
break
end
end
end
end)
1 Like
from what i can see from the
Position is not a valid member of ServerScriptService “ServerScriptService”
where did you put your script?
Oh wait! you made mover part the parent of server script service Even though, it was already referenced, lemme fix that
1 Like
It does the same thing as before where hes welded to the character while i move, I might just scrap the attack if its too hard
what is the moving part located?
It is located in Workspace workspace