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

[SOLVED] Script not working. checks if player is player(check bottom for more info) ?

Asked by 1 year ago
Edited 1 year ago

The script is supposed to check if player is a player and if the player is a player then it sets all parts in the model to CanCollide = false, but if its not a player then it sets CanCollide = true for al the parts in the Model. All the parts in the Model are named Cannotdelete. Why is the script not working?

local Players = game:GetService("Players")
local player = Players.LocalPlayer

local model = workspace.Grid.Model

for _, child in ipairs(model:GetChildren()) do
    if child:IsA("BasePart") then
        if player then
            child.CanCollide = false
        else
            child.CanCollide = true
        end
    end
end
0
I don't understand you're problem. Are you trying to check if a player touched the model? T3_MasterGamer 2189 — 1y
0
there are a bunch of parts in a model all of them are named Cannotdelete, I want to set all of the to CanCollide = false if a player touches the parts, but if anything else touches the part set CanCollide = true MariamOMG090 9 — 1y
0
nvm i solved it MariamOMG090 9 — 1y

Answer this question