-
What do you want to achieve? I want that after “hacking” the terminal, a select amount of walls get replaced with special ones, either giving you a curse, damaging you, making you slow, etc.
-
What is the issue? The
orientationof the walls don’t change or aren’t assigned, so it’ll look out of place, and make the level look BAD (they’re assigned usingCFrame) -
What solutions have you tried so far? I’ve tried using
for iloops, that didn’t work, assigningPositionandRotationinstead, that also didn’t work, multiplying theCFramewithCFrame.Angles(usingmath.rad) also didn’t work, if I’M doing anything wrong, please let me know.
ModuleScript used for it
local corruptions = script.Walls
local rng = Random.new()
return function(layout: Folder, maxchance: number, numbers: number | {number})
for _, wall:BasePart | Part in layout:GetChildren() do
local chance = rng:NextInteger(1, maxchance)
if (typeof(numbers) == "table" and not table.find(numbers, chance)) or (typeof(numbers) == "number" and chance ~= numbers) then
continue
end
local corruption: BasePart | Part = corruptions:GetChildren()[rng:NextInteger(1, #corruptions:GetChildren())]:Clone()
corruption.CFrame = wall.CFrame
corruption.Parent = layout
corruption.Name = "Wall"
task.delay(0.2,function()
wall:Destroy()
end)
end
end
The code from the terminal (Server)
script.Parent.Valid.OnServerEvent:Connect(function(player)
game.ReplicatedStorage.Message2:FireAllClients(
(player.Name.." has HACKED the first terminal!"),
Color3.fromRGB(0,255,0),
2
)
local ohmahgawd = script.Parent.Parent.Parent.Parent.Parent.Parent
ohmahgawd.GRANTEDGRANTEDGRANTEDGRANTEDGRANTED:Play()
ohmahgawd[":sure:"]:Play()
ohmahgawd.Music:Stop()
ohmahgawd.Music.SectionOne:Play()
script.Parent.Frame.Visible = true
for _, c in script.Parent:GetChildren() do
if c:IsA("Frame") or c:IsA("TextBox") or c:IsA("TextLabel") then
c.Visible = false
end
end
for _,player in game.Players:GetPlayers() do
local char = player.Character
if char then
char:PivotTo(script.Parent.Parent.Parent.Parent.Point.CFrame)
end
end
script.Parent.Parent.Parent.Parent.Door:Destroy()
script.Parent.Okay:FireAllClients()
game:GetService("TweenService"):Create(game.Lighting,TweenInfo.new(1,Enum.EasingStyle.Linear),{
Ambient = Color3.fromRGB(61, 61, 61);
OutdoorAmbient = Color3.fromRGB(48, 48, 48);
}):Play()
require(game.ReplicatedStorage:WaitForChild("WallCorrupter"))(ohmahgawd.Walls.SectionTwo,35,1)
task.delay(2.222,function()
game.ReplicatedStorage.Message2:FireAllClients(
"WARNING: This sublevel is LONG and DIFFICULT. Be prepared at all costs.",
Color3.fromRGB(150, 150, 150),
3
)
ohmahgawd.church_bell:Play()
end)
end)