#Lava spin
1 messages · Page 1 of 1 (latest)
I don't know anything about it, but I'm trying to make a minigame where I press the button and it activates and stops and the lava spins. I can play it with my friends.
So, let's say this?
- You click a red button
- A lava block spins
- You click it again, it stops spinning
Yes, it is exactly as I want. If I ask, can I have it modeled for me?
create a part in workspace: ButtonPart and LavaPart
and add a click detector in ButtonPart
Sorry for the delay, was working on my own project, but anyways place this into server script service. Whether it deals damage or not requires a separate script which i cant make at the moment
local ButtonPart = game.Workspace:WaitForChild("ButtonPart",5)
local LavaPart = game.Workspace:WaitForChild("LavaPart",5)
-- Variables
local spinSpeed = 90 -- How to spin the lava part (in degrees)
local isSpinning = false
-- Don't change the stuff below
if not ButtonPart then
print("Ensure ButtonPart is created in workspace and is named exactly 'ButtonPart'")
end
if not LavaPart then
print("Ensure LavaPart is created in workspace and is named exactly 'LavaPart'")
end
local clickDetector = ButtonPart:WaitForChild("ClickDetector",5)
if not clickDetector then
print("Ensure a ClickDetector is inserted into ButtonPart.")
end
clickDetector.MouseClick:Connect(function(click) -- We detect the click
isSpinning = not isSpinning
if isSpinning then
while isSpinning do
local delta = task.wait() -- Time since last frame
local rotateAmount = math.rad(spinSpeed * delta)
LavaPart.CFrame = LavaPart.CFrame * CFrame.Angles(0, rotateAmount, 0)
end
end
end)
Where should I paste this and in which section?
** You are now Level 1! **
a new server script in server script service
This code might not be that good because im still intermediate and am working on my own project at the moment, but should fulfill what you asked for
You can ask AI tools like ChatGPT to help you create code, but ensure you understand what the code actually does, and don't let it replace your learning
i paste
whats wrong
No problem
I apologize for bothering you. It's a responsibility. More information. Players can touch the camera from a distance. How do I set it up?