there is a maps folder in repstorage and a map will randomly be selected to be placed into workspace
then i have a localscript that essentially checks if a basepart i clicks parent name is “GameParts” then it will change the color of that part to an assigned color
i would like to use IsDescendantOf to do the check instead but if i have a model with that part insiode it wont do anything because the parts parents name isnt GameParts
i hope you can understand
i will provide screenshots and code if you would like some more infomation
local RepStorage = game:GetService("ReplicatedStorage")
local GameParts = RepStorage:WaitForChild("GameParts")
local function onClicked(part)
if part:IsDescendantOf(GameParts) then
-- change part to the colour you want
end
end
local clickDetector = script.Parent.ClickDetector
clickDetector.MouseClick:Connect(function()
local part = game.Workspace:FindPartOnRayWithIgnoreList(Mouse.UnitRay, {game.Players.LocalPlayer.Character})
if part then
onClicked(part)
end
end)
Obviously tweak it to match what you’ve already got in place