I've made like a game, about you can get these wishes from a genie. I want the genie to appear 2 studs beside me, but it's only moving the primarypart, not the whole model??
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local part = workspace.Genie.PrimaryPart -- I've already set the primarypart manually, so no need to worry
workspace.Genie:SetPrimaryPartCFrame(part.CFrame) -- setting the primary CFrame.
function setOffset(cframeX, head)
return head.CFrame:ToWorldSpace(cframeX) -- basically sets an offset from the head according to the position regardless of rotation
end
wait(2) -- waits a bit, because sometimes it can cause errors like; attempt to index nil with head
game:GetService("RunService").RenderStepped:Connect(function() -- for every frame thats running it will trigger the code above the "end)"
local newOff = setOffset(CFrame.new(0, 10, 0), character.Head) -- we fetch the offset
part.CFrame = newOff -- setting the parts cframe to the offset according to the head.
if not part.Massless then -- if the part has a mass
part.Massless=true -- make the part weightless, so it won't affect the pressure on the player
end
end) -- ends the code

1 comment
Please elaborate, and i will accept.