Has been fixed by someone in a roblox dev discord server
Hi i’ve been trying to fix this bug on my game for the past 10 days and i’ve only found out what was the problem right now, basically, for my game, a map from ServerStorage is cloned, then placed on workspace on a specific posistion. Inside this map there’s a door code system, and the code answer is stored as an IntValue inside the display that displays the code when clicked.
The problem is, when it’s a cloned map, with this code,:
local remote = game.ReplicatedStorage.RemoteEvents.EnableKeycode
local TweenService = game:GetService("TweenService")
local door = script.Parent.Parent
local doorCharniere = door.PrimaryPart
local doorTweenInfo = TweenInfo.new()
local doorCharTween = TweenService:Create(doorCharniere, doorTweenInfo, {
CFrame = doorCharniere.CFrame * CFrame.Angles(0, math.rad(120), 0)
})
remote.OnServerEvent:Connect(function(player,text)
local CodeValue = door.Parent.Parent.PC.Screen.Code
local GUI = player.PlayerGui.KeycodeGUI
local fix = GUI.Frame.Frame.CodeSee
if tonumber(text) == CodeValue.Value then
script.Parent.Correct:Play()
fix.Text = "Correct code"
fix.TextColor3 = Color3.fromRGB(0, 200, 0)
wait(1)
fix.Text = ""
fix.TextColor3 = Color3.fromRGB(255, 255, 255)
script.Parent.DoorOpen:Play()
doorCharTween:Play()
script.Parent.Prompt.Enabled = false
else
script.Parent.Incorrect:Play()
fix.Text = "Incorrect Code"
fix.TextColor3 = Color3.fromRGB(200, 0, 0)
wait(1)
fix.Text = ""
fix.TextColor3 = Color3.fromRGB(255, 255, 255)
end
end)
it will always say that the answer is false even though it is correct .
But when it’s not a cloned map (copy paste on workspace), and I do the same thing, this time the script works normally (displays “Correct code” when code is correct and “Incorrect code” when it’s incorrect.
I don’t understand why this happens but i’m almost sure that it’s not my scripts problem.
Any help is appreciated!
Version that doesn’t have problems(copy paste of the game but without cloning script and other things): debug.rbxl (126.8 KB)
Version that has problems : Atmos [Indev] - Roblox
Main game script ( clones the map) :
local Players = game:GetService("Players")
local intermisionLegnth = 30
local choosingMapLength = 15
local InRound = game.ReplicatedStorage.InGame
local LobbySpawn = game.Workspace.Lobby.LobbySpawn
local Status = game.ReplicatedStorage.Status
local ChoosingMap = game.ReplicatedStorage.ChoosingMap
local RoundSpawn = game.Workspace.Lobby.LobbySpawn
local minutes = 5
local seconds = 0
local mapChosen = game.ServerStorage["_Colorful Warehouse"]
while true do
for i = intermisionLegnth, 0, -1 do
InRound.Value = false
wait(1)
Status.Value = "Intermission ("..i..")"
end
ChoosingMap.Value = true
for i = choosingMapLength, 0, -1 do
wait(1)
Status.Value = "Choosing map... ("..i..")"
end
InRound.Value = true
ChoosingMap.Value = false
local pos = {Vector3.new(0,0,0),Vector3.new(0,0,200),Vector3.new(0,0,400),Vector3.new(0,0,600),Vector3.new(0,0,800),Vector3.new(0,0,1000),Vector3.new(0,0,1200),Vector3.new(0,0,1400),Vector3.new(0,0,1600),Vector3.new(0,0,1800),Vector3.new(0,0,2000),Vector3.new(0,0,2200),Vector3.new(0,0,2400),Vector3.new(0,0,2600),Vector3.new(0,0,2800),Vector3.new(0,0,3000),Vector3.new(0,0,3200),Vector3.new(0,0,3400),Vector3.new(0,0,3600),Vector3.new(0,0,3800)}
for i, player in pairs(Players:GetPlayers())do
local clone = mapChosen:Clone()
clone.Parent = game.Workspace.CurrentlyLoaded
clone:MoveTo(pos[i])
print("Initiated map"..mapChosen.Name..i)
local char = player.Character
char.HumanoidRootPart.CFrame = clone.Spawn.CFrame
end
repeat
if seconds <= 0 then
minutes = minutes - 1
seconds = 59
else
seconds = seconds - 1
end
if seconds <= 9 then
Status.Value = tostring(minutes)..":0"..tostring(seconds)
else
Status.Value = tostring(minutes)..":"..tostring(seconds)
end
wait(1)
until minutes <= 0 and seconds <= 0
minutes = 5
seconds = 0
workspace.CurrentlyLoaded:ClearAllChildren()
for i, player in pairs(Players:GetPlayers()) do
local char = player.Character
char.Humanoid.BreakJointsOnDeath = false
char.Humanoid.Health = 0
end
for i, player in pairs(Players:GetPlayers()) do
local char = player.Character
char.HumanoidRootPart.CFrame = LobbySpawn.CFrame
end
end
Also I noticed that the door tweening is also buggy when it’s a cloned map