Rotation = workspace.Existing1.Rotation.Vector3.new(0, 157.5, 0) i = -1 Goal = workspace.Existing1.Rotation.Vector3.new(0, i, 0) script.Parent.Touched:Connect(function(p) if p.Parent:FindFirstChild("Humanoid")then p.Parent.Humanoid.WalkSpeed = 0 end do Rotation + Goal until workspace.Existing1.Rotation.Vector3.new(0, 7.5, 0) end end)
Be aware I am really new to Lua.
I can see traces of other programming languages in that script. So first, you need to know what is the procedure of functions. Like, instead of do thing until thing
, in lua, it is repeat thing until thing
. Second thing, how to set properties. Third, better ways of doing thigs. Rotation
isn't using anymore in favor of CFrame
, and TweenService would be a better use instead of repeat until
. Here is the script, and I'll link api reference for you, as I can't explain everything here.
local tweenService = game:GetService("TweenService") local part = game.Workspace.Existing1 -- so you don't need to index it over and over again local tweenInfo = TweenInfo.new( 1, -- time for the tween to take Enum.EasingStyle.Linear, -- easing style, ima link the differences Enum.EasingDirection.In -- same for here, though it is the easing direction ) local tween = tweenService:Create(part,tweenInfo,{CFrame = CFrame.Angles(math.rad(-7.5))}) -- put the angle you want part.Touched:Connect(function(hit) -- for touched events you normally would use hit as an argument, though it obviously doesn't make any difference if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid.WalkSpeed = 0 end tween:Play() end)
TweenInfo TweenService CFrame property CFrame constructor math (scroll down to see math.rad usage) EasingStyle EasingDirection I think that's all. Hope this was helpful.