Log in to vote

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

Asked by 1 month ago
Edited 1 month 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
            child.CanCollide = true
I don't understand you're problem. Are you trying to check if a player touched the model? T3_MasterGamer 2142 — 1mo
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 — 1mo
nvm i solved it MariamOMG090 9 — 1mo

Answer this question