Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a way to set a Model's Orientation through a script?

My script does change the Model's orientation but it seems that once you click the button that activates the event it changes the orientation again, What I actually want it to do is, Set the orientation at a certain amount instead of increasing it by 20 every time I click it. I want it to stay at 20 if you understand what I mean.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent = ReplicatedStorage.BEDEVENTS2:WaitForChild("BedMovePos2")



local function onCreatePartFired(player)
do
if player:findFirstChild("leaderstats") then
		print "hey"
			local housetag = game.Workspace.PickSpawn[""..player.Name..""]
			local playerhouse = game.Workspace.PickSpawn:FindFirstChild(""..housetag.value.."")
			
			
			local cframe= CFrame.new(playerhouse.Spawn.Bed.PrimaryPart.Position)
			playerhouse.Spawn.Bed.PrimaryPart.Orientation = Vector3.new(0,20,0)
			playerhouse.Spawn.Bed:SetPrimaryPartCFrame(cframe * CFrame.new(0, math.rad(0), 0))

			
		




end
end
end


createPartEvent.OnServerEvent:Connect(onCreatePartFired)

1 comment

0

I'm very new so this probably wont work... But maybe you can put end where u want it to stop. I doubt it will work but it wont hurt to try

1 answer

✓ Accepted answer

Instead of cframe * CFrame.new(0, math.rad(0), 0), do cframe * CFrame.Angles(0, math.rad(0), 0)

1 comment

0

I love u

This discussion is preserved as it was. New answers, comments, and votes are closed.