plato2002
(No1RatedSalesman1997)
September 17, 2022, 1:48am
#1
So,i wanted to make a gaster blaster cuz bored,but i don’t know how to make the beam size in only one way so it wont look like this
I tried looking on devforum but couldn’t find anything (or i just have skill issue)
How can i make the beam resize only in one side?
Heres the script
local Tool = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local debounce = false
local TweenService = game:GetService("TweenService")
Tool.Activated:Connect(function()
if debounce ~= true then
debounce = true
local Blaster = ReplicatedStorage:WaitForChild("Blaster"):Clone()
Blaster.Parent = workspace
Blaster:SetPrimaryPartCFrame(Tool.Parent.HumanoidRootPart.CFrame * CFrame.new(20,0,10))
TweenService:Create(Blaster.Beamer,TweenInfo.new(1),{Size = Blaster.Beamer.Size + Vector3.new(200,0,0)}):Play()
TweenService:Create(Blaster.Jaws,TweenInfo.new(1),{CFrame = Blaster.Jaws.CFrame * CFrame.Angles(-80,0,0)}):Play()
TweenService:Create(Blaster.Beamer,TweenInfo.new(1),{Transparency = 0}):Play()
TweenService:Create(Blaster.Beamer,TweenInfo.new(1),{Size = Blaster.Beamer.Size + Vector3.new(200,0,0)}):Play()
end
end)
Thanks in advance.
0msh
(0msh)
September 17, 2022, 2:30am
#2
try tweening the size and position at the same time
avodey
(avocado)
September 17, 2022, 2:35am
#3
BaseParts have a Resize function that allows you to resize in a specific direction , using a face of the part.
plato2002
(No1RatedSalesman1997)
September 17, 2022, 3:13am
#4
I dont think that would work cuz the blaster should spawn near the player after using the tool
also i kinda tried it i think and the beam just goes to minecraft
local Tool = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local debounce = false
local TweenService = game:GetService("TweenService")
Tool.Activated:Connect(function()
if debounce ~= true then
debounce = true
local Blaster = ReplicatedStorage:WaitForChild("Blaster"):Clone()
Blaster.Parent = workspace
Blaster:SetPrimaryPartCFrame(Tool.Parent.HumanoidRootPart.CFrame * CFrame.new(20,0,10))
TweenService:Create(Blaster.Beamer,TweenInfo.new(1),{Size = Blaster.Beamer.Size + Vector3.new(200,0,0)}):Play()
TweenService:Create(Blaster.Jaws,TweenInfo.new(1),{CFrame = Blaster.Jaws.CFrame * CFrame.Angles(-80,0,0)}):Play()
TweenService:Create(Blaster.Beamer,TweenInfo.new(1),{Transparency = 0}):Play()
TweenService:Create(Blaster.Beamer,TweenInfo.new(1),{Size = Blaster.Beamer.Size + Vector3.new(200,0,0),Position = Blaster.Beamer.Position + Vector3.new(114,0,0)}):Play()
end
end)
plato2002
(No1RatedSalesman1997)
September 17, 2022, 3:13am
#5
Is there any way to tween it or something like that?
avodey
(avocado)
September 17, 2022, 3:25am
#6
No, just call the function in a renderstep event to increase the size linearly over time.
plato2002
(No1RatedSalesman1997)
September 17, 2022, 3:30am
#7
can i use a repeat loop? Would it do?
plato2002
(No1RatedSalesman1997)
September 17, 2022, 3:40am
#8
I used a repeat loop,it kinda works but how do i make the beam not go backwards?
(like its coming from the blaster)
local Tool = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local debounce = false
local TweenService = game:GetService("TweenService")
Tool.Activated:Connect(function()
if debounce ~= true then
debounce = true
local i = 0
local Blaster = ReplicatedStorage:WaitForChild("Blaster"):Clone()
Blaster.Parent = workspace
Blaster:SetPrimaryPartCFrame(Tool.Parent.HumanoidRootPart.CFrame * CFrame.new(20,0,10))
TweenService:Create(Blaster.Beamer,TweenInfo.new(1),{Size = Blaster.Beamer.Size + Vector3.new(200,0,0)}):Play()
TweenService:Create(Blaster.Jaws,TweenInfo.new(1),{CFrame = Blaster.Jaws.CFrame * CFrame.Angles(-80,0,0)}):Play()
TweenService:Create(Blaster.Beamer,TweenInfo.new(1),{Transparency = 0}):Play()
task.wait(0.3)
repeat
task.wait(0.005)
i += 1
Blaster.Beamer:Resize(Enum.NormalId.Right,3)
until i == 50
task.wait(1)
debounce = false
end
end)
plato2002
(No1RatedSalesman1997)
September 17, 2022, 4:00am
#9
It kinda uh,still goes two sides if i set the deltaAmount to 1
Wyv_n
(Wyvern)
September 17, 2022, 4:23am
#10
change the cframe and size and it’ll work
Wyv_n
(Wyvern)
September 17, 2022, 4:24am
#11
what i really mean is tween cframe and size
Wyv_n
(Wyvern)
September 17, 2022, 4:41am
#13
game:GetService("TweenService"):Create(Blaster.Beamer, TweenInfo.new(1), {Size = Blaster.Beamer.Size + Vector3.new(200,0,0), CFrame = Blaster.Jaws.CFrame * CFrame.new(-Blaster.Beamer.Size/2, 0, 0)}):Play()
try this
Wyv_n
(Wyvern)
September 17, 2022, 4:45am
#15
rn is it supposed to shoot up?
Wyv_n
(Wyvern)
September 17, 2022, 4:45am
#16
also show the code you currently have right at the moment.
plato2002
(No1RatedSalesman1997)
September 17, 2022, 4:50am
#17
It should shoot out in that direction
local Tool = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local debounce = false
local TweenService = game:GetService("TweenService")
Tool.Activated:Connect(function()
if debounce ~= true then
debounce = true
local i = 0
local Blaster = ReplicatedStorage:WaitForChild("Blaster"):Clone()
Blaster.Parent = workspace
Blaster:SetPrimaryPartCFrame(Tool.Parent.HumanoidRootPart.CFrame * CFrame.new(20,0,10))
TweenService:Create(Blaster.Beamer,TweenInfo.new(1),{Size = Blaster.Beamer.Size + Vector3.new(200,0,0)}):Play()
TweenService:Create(Blaster.Jaws,TweenInfo.new(1),{CFrame = Blaster.Jaws.CFrame * CFrame.Angles(-80,0,0)}):Play()
TweenService:Create(Blaster.Beamer,TweenInfo.new(1),{Transparency = 0}):Play()
task.wait(0.3)
game:GetService("TweenService"):Create(Blaster.Beamer, TweenInfo.new(1), {Size = Blaster.Beamer.Size + Vector3.new(200,0,0), CFrame = Blaster.Jaws.CFrame * CFrame.new(-Blaster.Beamer.Size/2, 0, 0)}):Play()
task.wait(1)
debounce = false
end
end)
Wyv_n
(Wyvern)
September 17, 2022, 4:52am
#18
try this
local Tool = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local debounce = false
local TweenService = game:GetService("TweenService")
Tool.Activated:Connect(function()
if debounce ~= true then
debounce = true
local i = 0
local Blaster = ReplicatedStorage:WaitForChild("Blaster"):Clone()
Blaster.Parent = workspace
Blaster:SetPrimaryPartCFrame(Tool.Parent.HumanoidRootPart.CFrame * CFrame.new(20,0,10))
TweenService:Create(Blaster.Beamer,TweenInfo.new(1),{Size = Blaster.Beamer.Size + Vector3.new(200,0,0)}):Play()
TweenService:Create(Blaster.Jaws,TweenInfo.new(1),{CFrame = Blaster.Jaws.CFrame * CFrame.Angles(-80,0,0)}):Play()
TweenService:Create(Blaster.Beamer,TweenInfo.new(1),{Transparency = 0}):Play()
task.wait(0.3)
game:GetService("TweenService"):Create(Blaster.Beamer, TweenInfo.new(1), {Size = Blaster.Beamer.Size + Vector3.new(200,0,0), CFrame = Blaster.Jaws.CFrame * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) * CFrame.new(-Blaster.Beamer.Size, 0, 0)}):Play()
task.wait(1)
debounce = false
end
end)
Joshument
(Joshument)
September 17, 2022, 5:24am
#20
If you’re increasing the size on the X axis, the CFrame should also move Part.CFrame.LookVector * (Size.X / 2)
as well to balance it out. Could probably be tweened like you want