Roblox: Difference between revisions

From Virtujoy Documentation
Created page with "* [https://create.roblox.com/dashboard/creations https://create.roblox.com/dashboard/creations] * [https://create.roblox.com/settings/eligibility/public-publish https://create.roblox.com/settings/eligibility/public-publish] * [https://create.roblox.com/docs/reference/engine/libraries/task] <syntaxhighlight lang="lua" line> local RunService = game:GetService("RunService") local Character = script.Parent.Parent local HumanoidRootPart = Character:FindFirstChild("HumanoidR..."
 
No edit summary
Line 2: Line 2:
* [https://create.roblox.com/settings/eligibility/public-publish https://create.roblox.com/settings/eligibility/public-publish]
* [https://create.roblox.com/settings/eligibility/public-publish https://create.roblox.com/settings/eligibility/public-publish]


* [https://create.roblox.com/docs/reference/engine/libraries/task]
== Task and heartbeat ==
* [https://create.roblox.com/docs/reference/engine/libraries/task https://create.roblox.com/docs/reference/engine/libraries/task]


<syntaxhighlight lang="lua" line>
<syntaxhighlight lang="lua" line>
Line 19: Line 20:
end)
end)
</syntaxhighlight>
</syntaxhighlight>
== Team ==
* [https://create.roblox.com/docs/reference/engine/classes/Team https://create.roblox.com/docs/reference/engine/classes/Team]

Revision as of 16:06, 6 February 2026

Task and heartbeat

local RunService = game:GetService("RunService")
local Character = script.Parent.Parent
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
local pet = script.Parent

local function SetPetCFrame()
	pet.PrimaryPart.CFrame = HumanoidRootPart.CFrame * CFrame.new(2, 2, -3)
end -- Hroot is player's HumanoidRootPart

RunService.Heartbeat:Connect(function()
	wait()
	SetPetCFrame()
end)

Team