#HumanoidRootPart not being anchored

12 messages · Page 1 of 1 (latest)

dry bolt
#
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local EMoveEvent = ReplicatedStorage:WaitForChild("EMoveEvent")
local Players = game:GetService("Players")

EMoveEvent.OnServerEvent:Connect(function(player)
    
    local character = player.Character
    
    if character then
        local humrp = character:WaitForChild("HumanoidRootPart")
        
        if humrp then
            local forwardVector = humrp.CFrame.lookVector
            local newPosition = humrp.CFrame.p + forwardVector * 100

            local hitboxPart = ReplicatedStorage:WaitForChild("EMoveHitbox"):Clone()
            hitboxPart.Parent = workspace
            hitboxPart.Position = newPosition
            
            local anchoredHumrp
            
            humrp.Anchored = true
            
            wait(1)
            
            humrp.Anchored = false

            task.spawn(function()
                while hitboxPart:IsDescendantOf(workspace) do
                    local partsInPart = workspace:GetPartsInPart(hitboxPart)
#
                    
                    for i, part in pairs(partsInPart) do
                        
                        if part.Name == "UpperTorso" then
                            local humInHitbox = part.Parent:FindFirstChild("Humanoid")
                            
                            if humInHitbox and humInHitbox.Parent ~= player.Character then
                                humInHitbox.Health = humInHitbox.Health - 10
                                
                                if player.UserId == 498997820 then

                                    anchoredHumrp = humInHitbox.Parent:FindFirstChild("HumanoidRootPart").Anchored
                                    anchoredHumrp = true
                                end
                            end
                        end
                    end
                    wait(1)
                end
            end)

            wait(10)
            
            if anchoredHumrp == true then
                anchoredHumrp = false
            end

            hitboxPart:Destroy()
        end
    end
end)
hasty sparrow
#

No errors? Tried debugging?

#

Debugging i find to be very helpful

#

Also, you said invokes a server, so its not a remote event, meaning you cant do Event.OnServerEvent

#

RemoteFunctions are handled differntly than RemoteEvents

dry bolt
#

@hasty sparrow no, no errors

#

also uh idk if i explained myself well

#

It's a server event yes

#

there's a script that handles the client part and then fires the event in the server

#

everything else works apart from that

#

I'll let you know later if i find something while debugging