Hello, I wanted to make a button when you press the button, the block spins like
fan, You can give a script, please, I need this script
I want a script for my game so that players can press a button and the block starts spinning
I will respect you for the script who will make this gift the script I will be very happy with you I will mark you as the winner!
I look forward to hearing from you 
Happy to help you! I made a clean and excellent code! Just put a script with this code on the βPartβ you want.
type Dictionary = Instance | {any} | {[any]: any}
local TweenService: TweenService = game:GetService("TweenService")
local ClickDetector: ClickDetector = Instance.new("ClickDetector")
ClickDetector.Parent = script.Parent;
local TimeGiration: number = 2; -- [The velocity. Increase it if you want something slower];
local TweenInfoCreate: TweenInfo = TweenInfo.new(TimeGiration, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
ClickDetector.MouseClick:Connect(function(playerWhoClicked: any | Player?): any
local GetPart: Part | BasePart | MeshPart = script.Parent
local Table: Dictionary = {}
Table.Orientation = GetPart.Orientation + Vector3.new(0, 360, 0)
local TweenCreate = TweenService:Create(GetPart, TweenInfoCreate, Table)
TweenCreate.Completed:Connect(function()
TweenCreate:Play()
end)
TweenCreate:Play()
end)
1 Like
Thank you, I will now check your script in the studio! 
Hey, put the part you want to rotate here:
local GetPart: Part | BasePart | MeshPart = script.Parent
1 Like
Use this here.
This will prevent
that the animation is repeated several times.
type Dictionary = Instance | {any} | {[any]: any}
local TweenService: TweenService = game:GetService("TweenService")
local ClickDetector: ClickDetector = Instance.new("ClickDetector")
ClickDetector.Parent = script.Parent;
local TimeGiration: number = 2;
local TweenInfoCreate: TweenInfo = TweenInfo.new(TimeGiration, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local ClickedDebounce: boolean = false
ClickDetector.MouseClick:Connect(function(playerWhoClicked: any | Player?): any
if not ClickedDebounce then
ClickedDebounce = true
local GetPart: Part | BasePart | MeshPart = script.Parent
local Table: Dictionary = {}
Table.Orientation = GetPart.Orientation + Vector3.new(0, 360, 0)
local TweenCreate = TweenService:Create(GetPart, TweenInfoCreate, Table)
TweenCreate.Completed:Connect(function()
TweenCreate:Play()
end)
TweenCreate:Play()
end
end)
1 Like