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

How do I make the work anywhere no matter where the model is Rotated? [Nevermind]

Asked by 9 years ago

I want it to work wherever the whole model is rotated. Like the rotation was like 90, 60, 90 but when I rotated the whole model, it made it like 17, 0, 0. Anyway to fix that problem? This is the same script I asked for the 'or' part, but different situation:

This script is in the position where the X and Z is 90. But if I like rotate the whole model it becomes like 17, 0, 0. So I want it to work no matter where the whole model is rotated. Hope you know what I mean.

This is the link to a video to make it more sense of what is going on! https://www.youtube.com/watch?v=0CiLlWS_Nz4&feature=youtu.be

01local tune = game.Workspace.Radio.Tune
02local pic = workspace.SongPosters.Decal
03sound = Instance.new("Sound", tune)
04debounce = false
05radioOn = false
06 
07function onClicked()
08    if debounce then return end --Stop the function if debounce is true.
09    debounce = true
10    if not radioOn then
11        radioOn = true
12        tune.Rotation = Vector3.new(tune.Rotation.X, -69.598, tune.Rotation.Z)
13        pic.Texture = "rbxassetid://174956680"
14        sound.SoundId = "rbxassetid://142295308" --Playing It's Raining Tacos
15        sound:Play()
View all 26 lines...

1 answer

Log in to vote
0
Answered by 9 years ago

pretty sure the fix is to not use Vector3 and use CFrame because if a moved Vector3 part touches another it will move somewhere to avoid going through it.

example:

1local part = script.Parent
2 
3function onClick(onClick)
4    part.CFrame = part.CFrame * CFrame.fromEulerAnglesXYZ(5, 5, 5)
5end
6 
7part.ClickDetector.MouseClick:connect(onClick)

i'll try to make it into yours but no promises!

1tune.CFrame = tune.CFrame * CFrame.fromEulerAnglesXYZ(0, -69.598, 0)
0
Thanks, but it's not doing like I wanted it to do. Here is the link of the video of what I wanted it to do: https://www.youtube.com/watch?v=0CiLlWS_Nz4&feature=youtu.be RobotChitti 167 — 9y
Ad

Answer this question