local workspace = game:GetService("Workspace")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local runService = game:GetService("RunService")
local function teleportCoinsToPlayer()
if not character or not character:FindFirstChild("Head") then
return
end
local globalCoinsFolder = workspace:WaitForChild("GlobalCoins")
for _, folder in pairs(globalCoinsFolder:GetChildren()) do
if folder:IsA("Folder") then
for _, coin in pairs(folder:GetChildren()) do
if coin:IsA("BasePart") then
local playerHead = character.Head
coin.CFrame = playerHead.CFrame * CFrame.new(0, 5, 0)
end
end
end
end
end
runService.Heartbeat:Connect(function()
teleportCoinsToPlayer()
end)
Comments
No comments yet
Be the first to share your thoughts!