Hello,
On Roblox Studio, I decided to make two parts, the first called “TouchedPart” and the second as “TouchedPart2”. Both contain scripts that have the function to fire specific events once being touched, and the goal of them is to clone a model, parent onto a folder and unachor the object’s parts.
While structuring its code lines and testing, it turns out that in a few moments it quite works, yet there are situations that make it unclear to understand… The parts appear to create multiple properties called TouchInterest
+ print a non-existence script that does not exist in any place of the game.Workspace
and/or the touched parts whatsoever.
TouchedPart’s Script:
local Players = game:GetService("Players")
workspace.TouchedPart.Touched:Connect(function(otherPart)
local maybeCharacter = otherPart.Parent
local player = Players:GetPlayerFromCharacter(maybeCharacter)
task.wait(2.75)
if player then
local Terrain = workspace.Terrain
local Clouds = Instance.new("Clouds", Terrain)
Clouds.Cover = 1
while Clouds == true do
break
end
local Building1 = game.ReplicatedStorage.Building1
local Build1_Clone = Building1:Clone()
Build1_Clone.Parent = game.Workspace
Build1_Clone.Name = "First_Build"
while Build1_Clone.Parent == game.Workspace do
Build1_Clone.Parent = game.Workspace.GameBuildings.Building1
break
end
workspace.TouchedPart.CanCollide = false
workspace.TouchedPart.CanTouch = false
workspace.TouchedPart.Script.Enabled = false
end
end)
TouchedPart2’s Script:
local Players = game:GetService("Players")
workspace.TouchedPart2.Touched:Connect(function(otherPart)
local maybeCharacter = otherPart.Parent
local player = Players:GetPlayerFromCharacter(maybeCharacter)
if player then
local Terrain = game.Workspace.Terrain
local Clouds = Terrain:FindFirstChildOfClass("Clouds")
if Clouds then
Clouds.Cover = 0.6
task.wait(2.75)
Clouds:Destroy()
while Clouds:Destroy() == nil do
break
end
end
workspace.TouchedPart.CanCollide = true
workspace.TouchedPart.CanTouch = true
workspace.TouchedPart.Script.Enabled = true
local Build1_Clone = game.Workspace.GameBuildings.Building1:FindFirstChild("First_Build")
if Build1_Clone then
print("success")
local Build1_Folder = game.Workspace.GameBuildings.Building1
Build1_Clone.Parent = Build1_Folder
for _, Build1_Folder in pairs(Build1_Folder:GetChildren()) do
if Build1_Folder:IsA("Folder") and Build1_Folder.Name == "Building1" then
for _, Parts in pairs(Build1_Clone:GetDescendants()) do
Parts.Anchored = false
end
end
end
end
end
end)
Unknown Script:
local Players = game:GetService("Players")
workspace.TouchedPart2.Touched:Connect(function(otherPart)
local maybeCharacter = otherPart.Parent
local player = Players:GetPlayerFromCharacter(maybeCharacter)
if player then
local Terrain = game.Workspace.Terrain
local Clouds = Terrain:FindFirstChildOfClass("Clouds")
if Clouds then
Clouds.Cover = 0.6
end
task.wait(2.75)
Clouds:Destroy()
task.wait(2.75)
if Clouds == nil then
print("success")
end
workspace.TouchedPart.CanCollide = true
workspace.TouchedPart.CanTouch = true
workspace.TouchedPart.Script.Enabled = true
end
end)
(NOTE: Unknown Script is different from the previous one)
If anyone can help me to solve this little lunatic puzzle, it would be appreciatable a lot! Thank you!!