local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char.Humanoid
local prin = true
local deb = true
local cubed = Instance.new("Part")
cubed.Name = "Cube"
cubed.FormFactor = "Custom"
cubed.Size = Vector3.new(0.5,0.5,0.5)
cubed.TopSurface = "Smooth"
cubed.BottomSurface = "Smooth"
cubed.Anchored = false
cubed.Transparency = 0.3
local w = Instance.new("ManualWeld")
w.Name = "Weldy"
w.Parent = char
w.Part0 = char["Right Arm"]
w.Part1 = cubed
hum.Running:connect(function(speed)
if speed > 0 then
if prin and deb then
deb, prin = false
---
cubed.Parent = char
w.Parent = char
local angle = 0
while true do
w.C0 = CFrame.new(0,-0.5,-1.5) * CFrame.Angles(angle, angle, angle)
wait()
angle = angle + 0.1
end
---
wait(0.2)
deb = true
end
elseif not prin and deb then
deb, prin = false, true
for index, child in pairs(char:GetChildren()) do
if child.Name == "Weldy" then
child.Parent = game:GetService("ReplicatedStorage")
end
end
print("Stopped")
for index, child in pairs(char:GetChildren()) do
if child.Name == "Cube" then
child.Parent = game:GetService("ReplicatedStorage")
end
end
wait(0.2)
deb = true
end
end)
while true do
w.C0 = CFrame.new(0,-0.5,-1.5) * CFrame.Angles(angle, angle, angle)
wait()
angle = angle + 0.1
end
When I add this lines of code, it doesn't want to go to repstorage, if I remove them and only leave the w.C0 = CFrame.new(0,-0.5,-1.5) it works perfectly, but when you add the loop it stops working.

2 comments
TAB YOUR CODE CORRECTLY!
I didn't really tab it alot because I made it on my phone. Sorry for the horrible looking code.