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

Changing Orientation of a Cylinder?

Asked by 5 years ago

I'm trying to make it so when cylinder is in the game, its flat sided rather than giving me the outline as shown below.

https://gyazo.com/7592bb6e463868aa54e86c3cdca50372

Instead I want it to look like this.

https://gyazo.com/1de31be6fcf701ce25e2eaacfb85af17

The following code is used to create this:

script.Parent.OnServerEvent:Connect(function(Player, Wand, TargetPos)
if Player.Character:FindFirstChild("Protego") == nil then
    Anim = script.Animation
    pps = Player.Character.Humanoid:LoadAnimation(Anim)
    pps:Play()
    local Protego = Instance.new("Part", Player.Character)
    Protego.Shape = "Cylinder"
    Protego.Size = Vector3.new(0.5, 7, 7)

    Protego.CFrame = CFrame.new(Player.Character:WaitForChild("HumanoidRootPart").Position +
        Player.Character["HumanoidRootPart"].CFrame.lookVector*5) * CFrame.fromEulerAnglesXYZ(0, math.rad(Player.Character["HumanoidRootPart"].Orientation.Y), 0)
    Protego.Anchored = true

    Protego.Material = "Neon"
    Protego.Transparency = .5
    Protego.Name = "Protego"
    Protego.Color = Color3.new(13/255, 105/255, 172/255)
    coroutine.resume(coroutine.create(function()
    wait(1)
    for Fade = 1,10 do wait()
    Protego.Transparency = Protego.Transparency + .05
    end
    Protego:remove()
    end))
else return end
end)

Any ideas on how to change it? I've tried playing with

Protego.Orientation = Vector3.new()

Then trying to form it from different angles, I've tried working to which everway the HumanoidRootPart is and I can't seem to get it the right way...

Thank you in advance.

0
Don't worry I can help SteamG00B 1633 — 5y

1 answer

Log in to vote
0
Answered by
SteamG00B 1633 Moderation Voter
5 years ago
Edited 5 years ago
script.Parent.OnServerEvent:Connect(function(Player, Wand, TargetPos)
if Player.Character:FindFirstChild("Protego") == nil then
    Anim = script.Animation
    pps = Player.Character.Humanoid:LoadAnimation(Anim)
    pps:Play()
    local Protego = Instance.new("Part", Player.Character)
    Protego.Shape = "Cylinder"
    Protego.Size = Vector3.new(0.5, 7, 7)

    Protego.CFrame = CFrame.new(Player:WaitForChild("HumanoidRootPart").Position +
        Player.HumanoidRootPart.CFrame.lookVector*5) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)--here
    Protego.Anchored = true

    Protego.Material = "Neon"
    Protego.Transparency = .5
    Protego.Name = "Protego"
    Protego.Color = Color3.new(13/255, 105/255, 172/255)
    coroutine.resume(coroutine.create(function()
    wait(1)
    for Fade = 1,10 do wait()
    Protego.Transparency = Protego.Transparency + .05
    end
    Protego:remove()
    end))
else return end
end)

Currently not giving desired results, will update it when I can come back to this.

0
It still does it :( xXTouchOfFrostXx 125 — 5y
0
I know, I am working in the studio trying to figure it out right now SteamG00B 1633 — 5y
0
Brilliant, thank you. :) xXTouchOfFrostXx 125 — 5y
0
got it SteamG00B 1633 — 5y
View all comments (3 more)
0
The spell doesn't seem to work now... xXTouchOfFrostXx 125 — 5y
0
I fixed the reason it wasn't working (HumanoidRootPart isn't part of player, its part of character.) However, it's still not lining in the correct position. xXTouchOfFrostXx 125 — 5y
0
No worries, thank you so much for your help. Lets hope we can get it to work soon :D xXTouchOfFrostXx 125 — 5y
Ad

Answer this question