So basically I’m working on a JoJo game and the stand’s arms just stay invisible, why is that?
CODE
while barraging do
RunService.Heartbeat:Wait()
local rightArm = ReplicatedStorage.Assets.Stands.TheWorld.RightArm:Clone()
local leftArm = ReplicatedStorage.Assets.Stands.TheWorld.LeftArm:Clone()
rightArm:SetPrimaryPartCFrame(StandReference.HumanoidRootPart.CFrame * CFrame.new(math.random(2,4),math.random(-1,3),math.random(-3,-1)) * CFrame.Angles(math.rad(90),0,0))
leftArm:SetPrimaryPartCFrame(StandReference.HumanoidRootPart.CFrame * CFrame.new(math.random(-4, -2),math.random(-1,3),math.random(-3,-1)) * CFrame.Angles(math.rad(90),0,0))
rightArm.Parent = StandReference
leftArm.Parent = StandReference
Debris:AddItem(rightArm, 2)
Debris:AddItem(leftArm, 2)
local info = TweenInfo.new(math.random(0.4, 1.2), Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
do
for _, v in pairs(rightArm:GetDescendants()) do
if v:IsA("BasePart") then
local goal = {}
goal.CFrame = v.CFrame * CFrame.new(0, math.random(-3,-1), 0)
goal.Transparency = 1
local tween = TweenService:Create(v, info, goal)
tween:Play()
end
end
for _, v in pairs(leftArm:GetDescendants()) do
if v:IsA("BasePart") then
local goal = {}
goal.CFrame = v.CFrame * CFrame.new(0, math.random(-3,-1), 0)
goal.Transparency = 1
local tween = TweenService:Create(v, info, goal)
tween:Play()
end
end
end
end
From my perspective, it seems that the loop is stopping after a few times.
Is there anything that’s disabling “barraging” before the end of the animation?
Other than that, I can’t see anything wrong with the code you provided…
What looks like is happening is all of the arms are tweened at the same time which might explain them all disappearing after a little while. Correct me if I am mistaken though.
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TheWorldRE = ReplicatedStorage.Remotes.TheWorld
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.Q then
TheWorldRE.Call:FireServer()
elseif input.KeyCode == Enum.KeyCode.E then
TheWorldRE.Barrage:FireServer()
end
end)
UserInputService.InputEnded:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.E then
TheWorldRE.Barrage:FireServer()
end
end)
SERVER SCRIPT CODE
TheWorldRE.Barrage.OnServerEvent:Connect(function(player)
if not StandReference then return end
local character = player.Character
local barrageAnimation = Instance.new("Animation")
barrageAnimation.AnimationId = "rbxassetid://5622454574"
local barrage = StandReference.Humanoid:LoadAnimation(barrageAnimation)
barrage.Name = "Barrage"
barraging = not barraging -- defined at the very top of the script
if barraging then
StandReference.PrimaryPart.StandWeld.Part1 = nil
StandReference.PrimaryPart.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -3)
StandReference.PrimaryPart.StandWeld.Part1 = character.HumanoidRootPart
barrage:Play(0.2)
while barraging do
RunService.Heartbeat:Wait()
local rightArm = ReplicatedStorage.Assets.Stands.TheWorld.RightArm:Clone()
local leftArm = ReplicatedStorage.Assets.Stands.TheWorld.LeftArm:Clone()
rightArm:SetPrimaryPartCFrame(StandReference.HumanoidRootPart.CFrame * CFrame.new(math.random(2,4),math.random(-1,3),math.random(-3,-1)) * CFrame.Angles(math.rad(90),0,0))
leftArm:SetPrimaryPartCFrame(StandReference.HumanoidRootPart.CFrame * CFrame.new(math.random(-4, -2),math.random(-1,3),math.random(-3,-1)) * CFrame.Angles(math.rad(90),0,0))
rightArm.Parent = StandReference
leftArm.Parent = StandReference
Debris:AddItem(rightArm, 1)
Debris:AddItem(leftArm, 1)
local info = TweenInfo.new(math.random(0.4, 1.2), Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
do
for _, v in pairs(rightArm:GetDescendants()) do
if v:IsA("BasePart") then
local goal = {}
goal.CFrame = v.CFrame * CFrame.new(0, math.random(-3,-1), 0)
--goal.Transparency = 1
local tween = TweenService:Create(v, info, goal)
tween:Play()
end
end
for _, v in pairs(leftArm:GetDescendants()) do
if v:IsA("BasePart") then
local goal = {}
goal.CFrame = v.CFrame * CFrame.new(0, math.random(-3,-1), 0)
--goal.Transparency = 1
local tween = TweenService:Create(v, info, goal)
tween:Play()
end
end
end
end
else
StandReference.PrimaryPart.StandWeld.Part1 = nil
StandReference.PrimaryPart.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(2,1.5, 2.5)
StandReference.PrimaryPart.StandWeld.Part1 = character.HumanoidRootPart
for _, track in pairs(StandReference.Humanoid:GetPlayingAnimationTracks()) do
if track.Name == "Barrage" then
track:Stop(0.2)
end
end
end
end)
Since you commented “goal.Transparency” – What does it do now?
Edit: Just asking, because of just making sure there is nothing interfering with the reference models
So it does work without setting transparency? Just not as cool as with transparency… Well it seems that, indeed the transparency seems to interfere with the reference model, or something else…
I don’t see anything wrong with your code. Perhaps the attachments, or Motor6D’s could be the source of the issue, is there any of these instances in the reference models?
Edit: Nevermind, we’re talking about the transparency, not the positioning, my bad.
I’ve looked around in the scripts at least 5 times, and I’ve found nowhere to be the source of the issue, I think you might just have to wait until someone else helps you with the issue, because I’m not familiar with humanoid animations, etc.
Correct me if i’m wrong, but it almost looks like as the arms are tweening to become invisible, your script that clones them is cloning the partially transparent arm, eventually cloning arms that are transparency = 1.
Would you be able to take a picture or a gif of your workspace with the transparency tween?
again i could be totally wrong, it just kind of looks like that to me