This is a video I got of it; first is roblox studio and second is ingame.
My code broke on line 32 BUT I am pretty sure that it broke not because of the script its in but the other script that actually sets it up. First iâll share the one with the error and the second is the one I think is actually breaking the game.
--Inside of a bool value inside of StarterCharacterScripts
local summon = game.ReplicatedStorage:WaitForChild("RemoteEvents").Stands:WaitForChild("Summon")
local desummon = game.ReplicatedStorage:WaitForChild("RemoteEvents").Stands:WaitForChild("DeSummon")
local hold = game.ReplicatedStorage:WaitForChild("RemoteEvents").Stands:WaitForChild("Held")
local tweenservice = game:GetService("TweenService")
local finishhold = game.ReplicatedStorage:WaitForChild("RemoteEvents").Stands:WaitForChild("FinishHeld")
summon.OnServerEvent:Connect(function(player) --connects to the summon in start
if player.Character.Attributes.CanSummon.Value == false then return end
if player.Name ~= script.Parent.Parent.Name then return end
local havestand = game.ReplicatedStorage:WaitForChild("Stands"):WaitForChild(script.Parent.Value)
local visstand = havestand:WaitForChild(script.Parent.Value):Clone()
local attributes = visstand:WaitForChild("Attributes")
visstand.Name = player.Name.."'s "..havestand.Name
visstand.Parent = player.Character
visstand.PrimaryPart.CFrame = player.Character.PrimaryPart.CFrame
task.wait(0.3)
visstand.PrimaryPart.CFrame = player.Character.PrimaryPart.CFrame * CFrame.new(attributes:FindFirstChild("Placement").Value)
for i, v in pairs(visstand:GetDescendants()) do
if v:IsA("BasePart") then
if v.Name:find("In") then
else
v.Transparency = 0
end
end
if v.Name == "HumanoidRootPart" then
v.Transparency = 1
end
end
while task.wait(.1) do --link hp
local userhealth = script.Parent.Parent.Humanoid
task.wait(1)
local standhealth = visstand.Humanoid --BREAKS HERE
userhealth.Changed:Connect(function()
standhealth.Health = userhealth.Health
end)
end
end)
Second:
--inside of a folder inside of the stand which is stored inside of the player.
if script.Parent.Parent.Name:find("'s ") then --if the name has the "'s"
print("im a clone!")
deb = true
if script.Parent.Parent.Name:find("Ghost") then --differentiate between a ghost and real stand fr
if not script.Parent.Parent.Parent.HumanoidRootPart:FindFirstChild("GhostAttachment") then
local standplacement = Instance.new("Attachment") --where ghost should be
standplacement.CFrame = CFrame.new(-0.5,0,0)
standplacement.Parent = script.Parent.Parent.Parent.HumanoidRootPart
standplacement.Name = "GhostAttachment"
end
local attachghostrn = Instance.new("AnimationConstraint")
attachghostrn.Parent = script.Parent.Parent.HumanoidRootPart
attachghostrn.Attachment0 = script.Parent.Parent.HumanoidRootPart.RootAttachment
attachghostrn.Attachment1 = script.Parent.Parent.Parent.HumanoidRootPart:FindFirstChild("GhostAttachment")
else
if not script.Parent.Parent.Parent.HumanoidRootPart:FindFirstChild("StandAttachment") then
local standplacement = Instance.new("Attachment") --where stand should be
standplacement.CFrame = CFrame.new(script.Parent.Parent.Attributes.Placement.Value)
standplacement.Parent = script.Parent.Parent.Parent.HumanoidRootPart
standplacement.Name = "StandAttachment"
print("exists!")
end
local attachstandrn = Instance.new("AnimationConstraint")
attachstandrn.Parent = script.Parent.Parent.HumanoidRootPart
attachstandrn.Attachment0 = script.Parent.Parent.HumanoidRootPart.RootAttachment
attachstandrn.Attachment1 = script.Parent.Parent.Parent.HumanoidRootPart:FindFirstChild("StandAttachment")
print("attached!")
end
--------------------------------------------------------------------------------------------------------------------------
while task.wait(.1) do --link hp
local standhealth = script.Parent.Parent.Humanoid
local userhealth = script.Parent.Parent.Parent.Humanoid
standhealth.Changed:Connect(function()
userhealth.Health = standhealth.Health
end)
end
end
Oh cool, iâve been summoned. I think my problem at the time was the code was running before the instances could load (either that or I was being stupid, I didnât know sh*t at the time). First thing I would try to do is make sure all game assets are loaded before running the script
Can you show us what is inside âscript.Parent.Valueâ?, if it is a character then try âlocal standhealth = visstand:WaitForChild(âHumanoidâ)â since you said:
script.parent.value changes depending on what the player chooses but its what they have. so if someone has the world then when that script fires it gets the world model.
Edit: I forgot to mention I already tried local standhealth = visstand:WaitForChild(âHumanoidâ) unfortunately.
Can you show us the error in the output?, since it changes dynamically, your other script mightâve changed it to something else other than a character with a Humanoid.
I found the problem occurs when the stand is pulled back in because its on a loop and that breaks the loop until fired again so it isnât a problem anymore. The main problem now is the 2nd script which doesnât attach the rig to the attachment like it should.
Itâs likely breaking because the stand model or itâs Humanoid doesnât exist yet (or has already been destroyed) when the script tries to access it. Roblox Studio tends to load things instantly and doesnât always replicate exactly like a live server, so timing issues can show up only in-game.
Youâre also running that health link inside a while loop, which keeps making new connections forever, that can easily cause errors once the stand is removed. Instead of looping, just connect once after confirming the Humanoid exists, e.g.:
local standHum = visstand:WaitForChild("Humanoid")
before using it.
So, all short, double check:
The stand clone is fully parented before referencing its Humanoid.
Youâre not reconnecting signals in a loop.
Youâre handling the case where the stand or character gets deleted.
Most likely itâs just a replication timing issue that only shows up in live servers, so adding a small WaitForChild() or a short delay before linking health should fix it.
Like said it previous comments, Iâve already tried
like in
unless you arent talking about humanoid health. in that case, which part are you talking about?
I am like 90% sure that the problem is in the second script where it isnât attaching; it just falls straight through the ground. So I tried making it a remote event instead of just running automatically + making it wait one second to make sure everything loads before the remote event fires and it still is broken.
Edit 2: I also updated the 2nd script:
local attach = game.ReplicatedStorage:WaitForChild("RemoteEvents").Stands:WaitForChild("Attach")
attach.OnServerEvent:Connect(function(player)
print(script.Parent.Parent.Parent.HumanoidRootPart:FindFirstChild("StandAttachment"))
script.Parent.Parent.HumanoidRootPart.Anchored = false
if script.Parent.Parent.Name:find("Ghost") then --differentiate between a ghost and real stand fr
local standplacement = script.Parent.Parent.Parent.HumanoidRootPart.GhostAttachment
standplacement.CFrame = CFrame.new(-0.5,0,0)
local attachghostrn = script.Parent.Parent.HumanoidRootPart.AnimationConstraint
attachghostrn.Attachment0 = script.Parent.Parent.HumanoidRootPart.RootAttachment
attachghostrn.Attachment1 = standplacement
else
local standplacement = script.Parent.Parent.Parent.HumanoidRootPart.StandAttachment
standplacement.CFrame = CFrame.new(script.Parent.Parent.Attributes.Placement.Value)
local attachstandrn = script.Parent.Parent.HumanoidRootPart.AnimationConstraint
attachstandrn.Attachment1 = script.Parent.Parent.Parent.HumanoidRootPart:FindFirstChild("StandAttachment")
print("attached!")
end
--------------------------------------------------------------------------------------------------------------------------
while task.wait(.1) do --link hp
local standhealth = script.Parent.Parent.Humanoid
local userhealth = script.Parent.Parent.Parent.Humanoid
standhealth.Changed:Connect(function()
userhealth.Health = standhealth.Health
end)
end
end)
That is the sign of the weld or animation constraint got delete after it welded into some parts, can you try to run the game and check for it inside the Explore tab to see if itâs still in the HumanoidRootPart during runtime?.
How do I look at Explore tab while in the game? I havenât been talking about pressing the âTestâ button on roblox studio; I have been talking about the play button to the game.
Edit: Although I still cant look at the explore tag inside of a game, I both turned on the visible feature for the attachments
Holy crap I just switched from AnimationConstraints to RigidConstraints and not only did it stop moving the player itself it also fixed the problem. Thank you to Halibon_Candy, DiscMil, and 2xA_Imagineer95 for helping!