-
What do you want to achieve?
I want the script to detect if all parts are the same or not. I’m doing this for material only.
-
What is the issue?
robloxapp-20220528-2355469.wmv (2.2 MB)
if you didn’t get that, isn’t it kind of odd for you just to start cleaning the ice and the game thinks you just cleaned the entire floor?
-
What solutions have you tried so far?
there doesn’t seem to be the ones I’m looking for
I do already know what’s happening here but, not on the code part.
This happens when you turn on the Zamboni cleaners and then get on the ice, then it turns on the value (HasWon).
local IP = script.Parent.Parent:GetChildren()
while wait(2) do
for i,IcePart in pairs(IP) do
if IcePart:IsA("BasePart") and IcePart.Material == Enum.Material.SmoothPlastic then--might have something to due with here
game.Workspace.Zamboni_Minigame_Badge.Position = Vector3.new(-158.5, 30.125, -209.5)
game.Workspace.HasWon.Value = true
elseif game.Workspace.HasWon.Value == false then
end
end
end
do not write entire scripts or design entire systems for you.
local CleanedParts = 0
local CleanedTable = {}
local CleanConnections = {}
local function clearConnections()
CleanedParts = 0
table.clear(CleanedTable)
for i,v in pairs(CleanConnections) do
v:Disconnect()
CleanConnections[i] = nil
end
end
local function registerCleaning()
clearConnections()
local IP = script.Parent.Parent:GetChildren()
if game.Workspace.HasWon.Value == false then
for _, IcePart in pairs(IP) do
if IcePart:IsA("BasePart") then
local NextConnection = #CleanConnections + 1
CleanConnections[#CleanConnections + 1] = IcePart:GetPropertyChangedSignal("Material"):Connect(function()
if IcePart.Material == Enum.Material.SmoothPlastic then
if table.find(CleanedTable, IcePart) == nil then
table.insert(CleanedTable, IcePart)
CleanedParts += 1
if CleanedParts == #IP then
game.Workspace.Zamboni_Minigame_Badge.Position = Vector3.new(-158.5, 30.125, -209.5)
game.Workspace.HasWon.Value = true
table.clear(CleanedTable)
CleanedParts = 0
end
CleanConnections[NextConnection]:Disconnect()
CleanConnections[NextConnection] = nil
end
end
end)
end
end
end
end
registerCleaning()
the code didn’t seem to work the way it was meant to work as.
Could you show the code which changes the material of the ice part?
it’s this one
=====================================
local IP = script.Parent.Parent:GetChildren()
while wait(2) do
for i,IcePart in pairs(IP) do
if IcePart:IsA(“BasePart”) and IcePart.Material == Enum.Material.SmoothPlastic then
game.Workspace.Zamboni_Minigame_Badge.Position = Vector3.new(-158.5, 30.125, -209.5)
game.Workspace.HasWon.Value = true
elseif game.Workspace.HasWon.Value == false then
end
end
end
===================================
local IP = script.Parent.Parent:GetChildren()
while wait(2) do
local PartsArentTheSame = false
for i,IcePart in pairs(IP) do
if IcePart:IsA("BasePart") and IcePart.Material == Enum.Material.SmoothPlastic then
else
PartsArentTheSame = true
break
end
end
if PartsArentTheSame == false then
game.Workspace.Zamboni_Minigame_Badge.Position = Vector3.new(-158.5, 30.125, -209.5) -- You could just award the badge yourself by using; game:GetService("BadgeService"):BadgeService:AwardBadge(playersUserId, badgeId)
game.Workspace.HasWon.Value = true
break
end
end
This was unexpected to see someone reply on a fix to this, it seemed like no-one was gonna reply after that point but, guess not, anyways.
I tested it and it dose nothing, my other script is disabled and testing this one you gave me and when I finish on the ice. It dose nothing, like nothing happens afterwards.
I even put print’s onto it and it dose work, it prints them it just that it doesn’t print the win part.