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 2 years ago
Edited 2 years 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?

01local Players = game:GetService("Players")
02local player = Players.LocalPlayer
03 
04local model = workspace.Grid.Model
05 
06for _, child in ipairs(model:GetChildren()) do
07    if child:IsA("BasePart") then
08        if player then
09            child.CanCollide = false
10        else
11            child.CanCollide = true
12        end
13    end
14end
0
I don't understand you're problem. Are you trying to check if a player touched the model? T3_MasterGamer 2189 — 2y
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 — 2y
0
nvm i solved it MariamOMG090 9 — 2y

Answer this question