#rig behaves weirdly

1 messages · Page 1 of 1 (latest)

ebon vortex
#

this works, but when i make it a client sided object (in player scripts) it breaks

karmic gazelle
#

u are tring to make enemies follow you

#

welp lets wait for oters

ebon vortex
neat bronzeBOT
#

studio** You are now Level 8! **studio

ebon vortex
#

:MoveTo() makes a humanoid follow u

karmic gazelle
#

yes

#

show your error

ebon vortex
#

but for some reason it dosent work because idk

karmic gazelle
ebon vortex
#

so?

karmic gazelle
#

alr

#

leme try that real quick

#

too see what the heck is the problem

ebon vortex
#

does it lag if its a lot of numbers or smth

karmic gazelle
livid stag
#

Im kinda curious to why you would even use remote-event for chasing part thinking

karmic gazelle
ebon vortex
#

wait

livid stag
karmic gazelle
livid stag
#

You can actually name "hit" anything

karmic gazelle
neat bronzeBOT
#

studio** You are now Level 1! **studio

ebon vortex
#

nope

neat bronzeBOT
#

studio** You are now Level 2! **studio

karmic gazelle
#

so hit is nothing 😭

ebon vortex
#

you need the remote, actually

karmic gazelle
livid stag
ebon vortex
#

because

#

you hit the part

livid stag
#

💀

#

You can just do this

#

workspace["YourPart"].Touched:Connect(function(Hit_)
if Hit_:IsA("BasePart") then
warn(Hit_.Name)
end
end)

karmic gazelle
#

lol

ebon vortex
#

wouldnt that fire for everyone if someone touches it

livid stag
#

Well yeah, but if you want it to be client side you'll need to set up a local script

#

Using remote event

ebon vortex
#

yeah i wanted the thing to be local

karmic gazelle
#

hmm i see

ebon vortex
#

😭

livid stag
ebon vortex
#

wdym

karmic jolt
ebon vortex
#

oh yep

#

lemme try to fix that rq

karmic jolt
#

and you're using while loops in event callback

neat bronzeBOT
#

studio** You are now Level 8! **studio

karmic jolt
#

do it separately

ebon vortex
#

wdym

karmic jolt
#

while loop outside the event, use what i call it "activation/deactivation flag" by using boolean

#

variable = boolean

#

when the event is fired, it sets a variable to true then the while loop can run

ebon vortex
#

oh yeah forgot i already fixed the remote being called multiple times

#

but like

#

it works

#

but very weirdly

karmic jolt
#

cool it works

#

explain weirdly

ebon vortex
#

lemme show a video

#

so yeah basically it works when it wants it to

#

the video is loading wait a second

karmic jolt
#

make it embed to discord

livid stag
#

@ebon vortex
-- Server

ocal ReplicatedStorage = game:GetService("ReplicatedStorage")
local ChasingScript = ReplicatedStorage:FindFirstChild("ChasingScript", true)

local PartTouch = workspace:WaitForChild("YourPart") -- Replace "YourPart" with the name of the part that you planned to trigger the "Chase" with
if not ChasingScript then
return warn("ChasingScript[1]", "does not exist.")
end

local ChasingScript1 = ChasingScript:FindFirstChild("ChaseScript1", true)

if not ChasingScript1 then
return warn("ChasingScript[2]", "does not exist.")
end

function OnTouch(Hit)
local Player = game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent)
if Player then
ChasingScript1:FireClient(Player, "EpicChase")
end
end

if not PartTouch then
PartTouch = Instance.new("Part", workspace)
PartTouch.Position = Vector3.new(0, 50, 0)
end

PartTouch.Touched:Connect(OnTouch)

Client:

local Workspace = game:GetService("Workspace")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local LocalPlayer = Players.LocalPlayer or Players.PlayerAdded:Wait()
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local Root = Character:WaitForChild("HumanoidRootPart")

-- ChasingScript
local ChasingScript = ReplicatedStorage:FindFirstChild("ChasingScript", true)

if not ChasingScript then
return warn("ChasingScript does not exist.")
end

local ChasingScript1 = ChasingScript:FindFirstChild("ChaseScript1", true)

if not ChasingScript1 then
return warn("ChasingScript1 does not exist.")
end

-- Event for handling chasing logic
function CE_Event(Action)
if Action == "EpicChase" then
local Enemi = Workspace:FindFirstChild("enemi")
if not Enemi or not Enemi:FindFirstChild("HumanoidRootPart") or not Enemi:FindFirstChild("EpicHumanoid") then
return
end
local EnemiRoot = Enemi:FindFirstChild("HumanoidRootPart")
local EpicHumanoid = Enemi:FindFirstChild("EpicHumanoid")

    local StopDistance = 5 -- Distance at which the Enemi stops chasing :3

    local function ChasePlayer()
        local direction = (Root.Position - EnemiRoot.Position).unit
        local Distance = (Root.Position - EnemiRoot.Position).magnitude

        if Distance > StopDistance then
            -- Move the Enemi towards the player!!!
            EpicHumanoid:MoveTo(Root.Position)
        else
            return
        end
    end

    -- Start chasing
    RunService.Heartbeat:Connect(ChasePlayer)
end

end

-- Listening for the event
ChasingScript1.OnClientEvent:Connect(CE_Event)

#

yes i rewrited your code 💀

#

It took a while

ebon vortex
#

damn

#

thank you

#

ill try when i can

#

ty

livid stag
#

👍

median galleon
#

and for gods sake just use pathfinding

karmic gazelle
#

Yes

neat bronzeBOT
#

studio** You are now Level 3! **studio

karmic gazelle
#

Pathfinding

median galleon
karmic gazelle
#

Instance making the part , looks AI lol

livid stag
#

I said simple for a reason!!!

median galleon
livid stag
#

Im just tryna to help luis

median galleon
#

well youre doing it extremely wrong

#
  1. Youre spoonfeeding him
  2. Youre spoonfeeding him bullshit
livid stag
median galleon
#

too many

karmic gazelle
#

I don't wanna argue so ima just read lol

livid stag
#

Too many if?

median galleon
livid stag
neat bronzeBOT
#

studio** You are now Level 2! **studio

livid stag
#

Thanks mee6 🔥

median galleon
livid stag
#

😔

median galleon
#

try to learn and then come back to it

#

youll see whats wrong

#

unless you didnt make it

#

but an autonomous algorythm

livid stag
#

I made it tho, That's just my style of coding 😔

median galleon
#

anyway, pointless argument. No spoonfeeding and @ebon vortex use pathfinding

#

learn it

#

use it

#

no gpt or else youre fucking urself

livid stag
#

PathfindingService?

median galleon
median galleon
livid stag
#

Memory leak is about to go crazy

karmic gazelle
#

I like reading bullshit chats

livid stag
#

Everything is bullshit mate

median galleon
karmic gazelle
#

What @median galleon says are facts

ebon vortex
#

yea i dont like people giving me code from 0

#

because i dont learn anything