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

How do I make the Rotation work no matter where it is Positioned?

Asked by 8 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

local tune = game.Workspace.Radio.Tune
local pic = workspace.SongPosters.Decal
sound = Instance.new("Sound", tune)
debounce = false
radioOn = false

function onClicked()
    if debounce then return end --Stop the function if debounce is true.
    debounce = true
    if not radioOn then
        radioOn = true
        tune.Rotation = Vector3.new(tune.Rotation.X, -69.598, tune.Rotation.Z)
        pic.Texture = "rbxassetid://174956680"
        sound.SoundId = "rbxassetid://142295308" --Playing It's Raining Tacos
        sound:Play()
    elseif radioOn and sound.SoundId == "rbxassetid://174654610" then
        radioOn = false
        sound:Stop()
        tune.Rotation = Vector3.new(tune.Rotation.X, -89.282, tune.Rotation.Z)
        pic.Texture = "rbxassetid://271952704"
        print("Off")
    end
    debounce = false
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)


Answer this question