So, I’m trying to make it so that I spawn in a group of parts that have body velocity from server storage.
I’m trying to make that group of parts to clone into workspace. And then have them despawn after 5 seconds.
So, I’m trying to make it so that I spawn in a group of parts that have body velocity from server storage.
I’m trying to make that group of parts to clone into workspace. And then have them despawn after 5 seconds.
game.ServerStorage.Parent = game.Workspace
—Put a value in replicatedstorage
Game.ReplicatedStorage.Value = 2
Game.ServerStorage.Value = game.Workspace
Tell me what the error is if there is one
What do you mean by “Put a value in”
the value is the part clone. The value has to be the number of the parts you want.
So basically you want to clone a group of parts into workspace and despawn them after 5 seconds? Sure!
local BoneSpawn = game.ServerStorage.BoneSpawn:Clone()
BoneSpawn.Parent = workspace
wait(5)
BoneSpawn:Destroy()
Also, could you be specific about the BodyVelocity, what would you do with it?
Why are you setting the parent of the ServerStorage to the workspace and why are you setting a value to a workspace?
So, I have a undertale themed “Obby” and at times the enemy will shoot out the group of parts (bones) And the body velocity would make them goto the player. And the player would have to jump over them.
You can’t clone from the client and if your replicating form a service that hasn’t been rendered yet and you wanna put it in a service still that doesn’t get render’d such as starter pack you need to clone it to workspace then clone it to starter pack
Do you know how I could make it so the whole group is effected by the body velocity?
Oh right! Well, since the BodyVelocity will work with it’s parent, maybe you could create a part which can be the primary part of the group and set the parent of the BodyVelocity to the primary part.
So basically:
What do you mean by primary part?
I should watch a youtube video, I don’t understand that at all.
So, I tried this but it doesn’t seem to work, can you help debug it?
workspace.BoneSpawn.PrimaryPart = workspace.BoneSpawn.Center
while true do
for i = 1,100 do
wait()
workspace.BoneSpawn.SetPrimaryPartCFrame(CFrame.new(workspace.BoneSpawn.PrimaryPart.Position + Vector3.new(0,0,1)))
end
end
Oh so let me explain it here:
A primarypart is basically a part that is mostly in control of the model, so for example a player’s character primary part is a HumanoidRootPart, when that HumanoidRootPart moves then the rest of the character will, so from that definition, I would want you to create a part and put it into the model so that it can control the primarypart which will control the model, if you still don’t get what I mean then feel free to watch a YouTube video.
Add a wait() on the while loop not on the for loop:
I tried for it to be anchored and unanchored but it still doesn’t work…
Oh I missed out something, do :SetPrimaryPartCFrame not .SetPrimaryPartCFrame because it’s a function, so swap the period to the colon.
try this
Server script
local BoneSpawn = game.ServerStorage:WaitForChild("BoneSpawn"):Clone()
BoneSpawn.Parent = workspace
local Waiting = os.time()
repeat wait()
if os.time() - Waiting <5 then
if workspace:FindFirstChild("BoneSpawn") then
workspace.BoneSpawn:Destroy()
break
end
else
continue
until os.time()-Waiting < 5
I hope that works
The spawning script is working but the moving script is not, This is the moving script that I have. I also currently have the moving script in workspace.
workspace.BoneSpawn.PrimaryPart = workspace.BoneSpawn.Center
while true do
for i = 1,100 do
workspace.BoneSpawn:SetPrimaryPartCFrame(CFrame.new(workspace.BoneSpawn.PrimaryPart.Position + Vector3.new(0,0,1)))
end
wait() -- add a wait to the while loop so it does not crash the game
end