I’m making a theme park and I have made a few rides but I’m having one issue. I’m creating a windseeker (if you don’t know that ride pls google it first). and the up and down motion works great but I have never made a ride spin before. So, about 1/3 of the way up I need the ride to start spinning, and 2/3 of the way down stop spinning. I can adjust the setting of it. but I need the basic script to rotate it around. Pls help!
THIS IS THE UP AND DOWN SCRIPT FOR AN EXAMPLE!!!
workspace.Tower.Main.PrimaryPart = workspace.Tower.Main.MainPart
local ClickDetector = script.Parent.Parent.balls.ClickDetector
local active = false
ClickDetector.MouseClick:Connect(function()
active = true
wait(15)
while active do
for i = 1,590 do
wait(.01)
workspace.Tower.Main:SetPrimaryPartCFrame(CFrame.new(workspace.Tower.Main.PrimaryPart.Position + Vector3.new(0,.5,0)))
end
wait(18)
for i = 1,590 do
wait(.01)
workspace.Tower.Main:SetPrimaryPartCFrame(CFrame.new(workspace.Tower.Main.PrimaryPart.Position - Vector3.new(0,.5,0)))
end
wait(2)
if active then
active = false
break
end
end
end)
1 Like
rotation = CFrame.Angles(0, math.rad(90), 0)
modelCFrame = model:GetPrimaryPartCFrame()
model:SetPrimaryPartCFrame( modelCFrame*rotation )
This may help?
2 Likes
Where should i put this in and what should i change about it
Define the model and wrap the script in a while loop (sorry If Im confusing you)
Ur all good im fairly new to scripting
im still learning (trying to) could you like make this script for me bc this is what i tried and it didnt work
local model = script.Parent
while true do
rotation = CFrame.Angles(0, math.rad(90), 0)
modelCFrame = model:GetPrimaryPartCFrame()
model:SetPrimaryPartCFrame( modelCFrame*rotation )
end
In the model property,assign its Primarypart to a part which is inside the model and then put this script inside the model (It should work)
while true do
script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(0,.5,0))
wait()
end
1 Like
Okay. That is understood. Should i put it in the same script as the up and down? or separate?
Are u talking about this script?
I figured it out. But when the ride goes up and down yk. the spinning stops
workspace.Tower.Main.PrimaryPart = workspace.Tower.Main.MainPart
local ClickDetector = script.Parent.Parent.balls.ClickDetector
local active = false
ClickDetector.MouseClick:Connect(function()
active = true
wait(15)
while active do
for i = 1.590 do
wait(.01)
workspace.Tower.Main:SetPrimaryPartCFrame(CFrame.new(workspace.Tower.Main.PrimaryPart.Position + Vector3.new(0,.5,0)))
end
wait(18)
for i = 1.590 do
wait(.01)
workspace.Tower.Main:SetPrimaryPartCFrame(CFrame.new(workspace.Tower.Main.PrimaryPart.Position - Vector3.new(0,.5,0)))
end
wait(2)
if active then
active = false
break
end
end
end)
You forgot that you putted “,” and not “.”.
Can u show a video? I do not understood what u meant.
Also did u also tried something like this?
while true do
script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(0,.1,0))
script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame + Vector3.new(0,0.5,0))
wait()
end
try this? (just put the script in the model, should work)
The Script you posted earlier??
This one
while true do
script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(0,.1,0))
script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame + Vector3.new(0,0.5,0))
wait()
end
yes this works but it spins very fast and never stops.
also it just goes up forever it needs to stop eventually
local x = 1
local activate = true
if activate == true then
while activate do
script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(0,.5,0))
script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame + Vector3.new(0,0.5,0))
x+=1
if x == 50 then
activate = false
wait()
end
end
im assuming this is the new script. how does it work and is there anything i need to change