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

Whenever someone goes near the rotating model it goes above their head?

Asked by 7 years ago

Hey, I've created a script to rotate a csg object but when a user goes slightly under it, or by chance touches it in a certain position, it raises above the user's head.

What I'm asking is, how do i make the brick rotate without it going upwards when a player is underneath.

Here is the short script:

while true do
    wait()
    script.Parent.Rotation = script.Parent.Rotation + Vector3.new(1.2, 0, 1.2)
end
0
Not an answer but, you should add a :Wait() in there else the script will just break. awfulszn 394 — 7y
0
You need to show the script that controls the model's movement. I suspect it's using :MoveTo (though I don't know how it's rotating with that), since using :SetPrimaryPartCFrame does not exhibit the behaviour you described. chess123mate 5873 — 7y
0
@chess123mate no, this is the whole script. I'm not moving the object anywhere, only rotating it. @mosskil23 there is a wait, right after the line saying 'while true do' GammaShock 32 — 7y

1 answer

Log in to vote
0
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

You should use CFrames.

Setting the position, rotation or size will take Collision into the math, wich will eventualy put it on top.

How to use CFrames:

while true do   
    Part.CFrame = Part.CFrame * 
        CFrame.Angles(
            --math.rad(float) converts radians to degrees.
            math.rad(DegreeYouWant), -- X Rotation in Radians
            0, -- Y Rotation in Radians
            0 -- Z Rotation in Radians
        )

    wait()
end
Ad

Answer this question