Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to make a part spin for the shuriken?

Asked by 2 years ago

upon pressing b my parts spawn however the part won't spin how can i make it do this ?


uis.InputBegan:Connect(function(key) if key.KeyCode == Enum.KeyCode.B then block = not block local hrp = game.Players.LocalPlayer.Character.HumanoidRootPart local parts = {} local numberofparts = 4 for i = 1, numberofparts do table.insert(parts, game.ReplicatedStorage.nail:Clone()) end for i, part in pairs(parts) do part.Anchored = false part.CanCollide = true part.Parent = workspace end local fullcircle = 2 * math.pi local radius = 10 local function GetXandZ(angle) local x = math.cos(angle) * radius local Z = math.sin(angle) * radius return x,Z end game:GetService("RunService").Heartbeat:Connect(function() if block == true then for i,part in pairs(parts) do local angle = i *(fullcircle/#parts) local x,Z = GetXandZ(angle) local position = hrp.CFrame*CFrame.new(x,0,Z).Position local Lookat = hrp.Position part.CFrame = CFrame.new(position,Lookat)) end elseif block == false then for i,part in pairs(parts) do part:destroy() end end end) end end)

thanks in advance

Answer this question