Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
October 10, 2021 03:51 pm GMT

LOCAL SCRIPT

local PLAYER = game.Players.LocalPlayer
local PET = PLAYER:WaitForChild("EQUIPPED_PET", true)
local PETS_LIST = require(game.ReplicatedStorage.PETS_LIST)

local STEPPED = nil
local POS = nil
local GYR = nil

local function GET_PET(CHAR, NAME)
for _, v in pairs(CHAR:GetChildren()) do
if v:IsA("BasePart") and table.find(PETS_LIST, v.Name) then
if table.find(PETS_LIST, v.Name) then
return v
end
end
end
end

local function GET_MOVERS(PET)
for _, v in pairs(PET:GetChildren()) do
warn(v.ClassName)
if v:IsA("BodyPosition") then
POS = v
end
if v:IsA("BodyGyro") then
GYR = v
end
end

end

PET.Changed:Connect(function(NAME)
local PET = GET_PET(PLAYER.Character, NAME)
print(PET)
if PET ~= nil then
GET_MOVERS(PET)
print(POS, GYR)
if STEPPED then
STEPPED:Disconnect()
end

    STEPPED = game:GetService("RunService").Stepped:Connect(function()        if PLAYER.Character.Humanoid.Health > 0 then            local DEST = CFrame.new(PLAYER.Character.Head.CFrame * Vector3.new(1, 0, 2)).p            local CF = PLAYER.Character.Head.CFrame            POS.Position = DEST            print(POS.Position)            GYR.CFrame = CF        else            if STEPPED then                STEPPED:Disconnect()            end            POS.MaxForce = Vector3.new(0, 0, 0)            POS = nil            GYR = nil        end    end)end

end)

.


Original Link: https://dev.to/joinmoin0002/local-script-1hi7

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To