Hi
So what i want to do is to set my model’s rock’s CanCollide to true,
First, the rock are welded to a part ,so i can tween the part which will also affect the rocks.
Then the part the destroyed to remove the welds and set the rock’s cancollide to true(cancollide is set to false in the beginning since they appear from the underground)
I added this loop which has to set the cancollide of the rocks to true so they fall and stay on the ground
rocks:WaitForChild("Part"):Destroy() --deletes part that welds the rocks together
for i, v in pairs(rocks:GetChildren()) do -- sets the rocks cancollide to true
v.CanCollide = true
end
But, i think that the script works fine, but the rocks gets “yeeted” really fast and goes somewhere else, which is not what i want. So, is it because of the script or something about physics
as shown in this vid: https://gyazo.com/e3b72ade562f86867bd9320828aaabc3
so then, they appeared here:
make sure the part is anchored. Otherwise it’ll fall down.
Make the script this
rocks:WaitForChild("Part"):Destroy() --deletes part that welds the rocks together
for i, v in pairs(rocks:GetChildren()) do -- sets the rocks cancollide to true
v.CanCollide = true
v.Anchored = true
end
It made the rocks stay still, i want them to fall on the ground that they are floating on.
Also, when u say part, is it the part that is welding the rocks or the rocks themselves
make the part that the rock is welded to cancollide set to true. That way the rocks can don’t have collisions but the part it’s welded to will make sure physics is still applied
well can I see how you’re doing it? like the part1, part0. The part’s size and stuff. You should also make the part that’s welded be the same size as the rock and the same position as it.
ok so i replaced the weld with motor6ds, it still didn’t work
heres the full script
local rs = game:GetService("ReplicatedStorage")
local RemoteEvent = rs:WaitForChild("RockFolder"):WaitForChild("RemoteEvent")
RemoteEvent.OnServerEvent:Connect(function(player)
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local humrp = character:WaitForChild("HumanoidRootPart")
local rocksFolder = Instance.new("Folder", workspace:WaitForChild("Ignore"))
rocksFolder.Name = player.Name.."'s rocks"
local rocks = rs:WaitForChild("RockFolder"):WaitForChild("rocks"):Clone()
rocks.Parent = rocksFolder
rocks:PivotTo(CFrame.new(humrp.Position) * CFrame.new(0,-15,0))
rocks:WaitForChild("Part").Orientation = Vector3.new(0,math.random(-180,180),0)
local tweenService = game:GetService("TweenService")
local goal = {
Position = rocks:WaitForChild("Part").Position + Vector3.new(0,15,0)
}
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local tweenPos = tweenService:Create(rocks:WaitForChild("Part"), tweenInfo, goal)
rocks:WaitForChild("Part").Anchored = true
rocks:WaitForChild("Part").CanCollide = false
tweenPos:Play()
local rayParams = RaycastParams.new()
rayParams.FilterDescendantsInstances = {workspace.Ignore}
rayParams.FilterType = Enum.RaycastFilterType.Blacklist
for i, v in pairs(rocks:GetChildren()) do
local ray = workspace:Raycast(v.CFrame.Position + Vector3.new(0, 15, 0), Vector3.new(0, -100, 0), rayParams)
if ray then
v.Material = ray.Instance.Material
v.Color = ray.Instance.Color
end
end
for i, v in pairs(rocks:GetChildren()) do
if v.Name == "Rock" then
local goal2 = {
Transparency = 0
}
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local tweenT = tweenService:Create(v, tweenInfo, goal2)
tweenT:Play()
end
end
wait(1)
for i, v in pairs(rocks:GetChildren()) do
for i, Attachment in pairs(v:GetChildren()) do
for i, Attachment in pairs(Attachment:GetChildren()) do
if Attachment.Name == "particle" then
Attachment.Enabled = true
end
end
end
end
wait(5)
rocks:WaitForChild("Part"):Destroy() -- deletes part's welds so rocks can fall on ground
RemoteEvent:FireClient(player)
end)