Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Changing Orientation of a Cylinder?

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.

2 comments

0

Don't worry I can help

1 answer

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.

7 comments

0

It still does it :(

0

I know, I am working in the studio trying to figure it out right now

0

Brilliant, thank you. :)

0

got it

0

The spell doesn't seem to work now...

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.

0

No worries, thank you so much for your help. Lets hope we can get it to work soon :D

This discussion is preserved as it was. New answers, comments, and votes are closed.