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

How am I suppose to set the CFrame of a block higher than the last block CFame?

hello, scripters.

I'm trying to make a temporary ore spawn system that spawns ores in a vertical way however this is the first time i've tried and i'm confident this: local newcframe = primarypartcframe * CFrame.new(1,currentWidth+1,1) should work.. what am I doing this wrong?

	for i = currentWidth,maxWidth,1 do
		--// roll odds
		local block = chancemodule:Roll(chancetable.Tier1Layer)
				
		--// clone block
		local cloneblock = game.ReplicatedStorage.Ores[block]:Clone()
		cloneblock.Parent = workspace
				
		--// set block cframe
		local primarypartcframe = cloneblock:GetPrimaryPartCFrame()
		local newcframe = primarypartcframe * CFrame.new(1,currentWidth+1,1) --should work?
		cloneblock:GetPrimaryPartCFrame(newcframe)
				
		--// print currentWidth
		wait()
		print("currentwidth = "..i)
	end

hopefully this is enough info to help however if you need more info then i'll give it. :)

1 answer

✓ Accepted answer

The reason it didn't work is because you're trying to make CFrame convert a string, this will not work. Instead, do this, in other words, it will error because PrimaryPartCFrame does not exist, you will need to get the model of what you're trying to do.

local primaryPartCFrame = model:GetPrimaryPartCFrame()
	local newCFrame = primaryPartCFrame * CFrame.Angles(0, math.rad(10), 0)
	model:SetPrimaryPartCFrame(newCFrame)

If I helped you, make sure to accept my answer

Fixed grammatical errors - February 2, 2021

1 comment

0

fixed it, thanks for answering!

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