Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My script always deletes itself when dealing with collisons?

Asked by 6 years ago

I am trying to make players not collide with each other, and I'm new to collision groups. Some reason, when I have a script run, in the game it is just gone, no where to be found. I don't understand why, but if I do a local server test and paste it into the server all the output says is "Could not create collision group"

script.Parent = game:GetService("ServerScriptService")

local PhysService = game:GetService("PhysicsService")

local PlayerGroup = PhysService:CreateCollisionGroup("p")
PhysService:CollisionGroupSetCollidable("p","p",false)

function NoCollide(model)
    for k,v in pairs(model:GetChildren()) do
        if v:IsA"BasePart" then
            PhysService:SetPartCollisionGroup(v,"p")
        end
    end
end

game:GetService("Players").PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
        char:WaitForChild("HumanoidRootPart")
        char:WaitForChild("Head")
        char:WaitForChild("Humanoid")
        wait(0.1)
        NoCollide(char)
    end)

    if player.Character then
        NoCollide(player.Character)
    end
end)
0
You put the script in the ServerScriptService, on line 1. thesit123 509 — 6y
0
I have tried putting it in Workspace and ServerScriptServer, it always goes away no matter what. Draebrewop 114 — 6y
0
Save exit and reload studio. That can sometimes do it,., #roblox Bellyrium 310 — 6y
0
Unfortunately not :/ Draebrewop 114 — 6y

Answer this question