local ReplicatedStorage= game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local Hint = Instance.new("Hint")
Hint.Parent = workspace
local AK12 = require(ReplicatedStorage.GunModules.AK12)
function LoopTable(Table)
local String = ""
for Key, Value in pairs(Table) do
String = String .. Key .. " = " .. tostring(Value) .. "\n"
end
return String
end
function TableEquality(Table, Table2)
local String = ""
for I, V in pairs(Table) do
for I2, V2 in pairs(Table2) do
if V ~= V2 and I == I2 then
if typeof(V2) == "Vector3" then
String = String .. "Table." .. I2 .. " = " .. "Vector3.new(" .. tostring(V2) .. ")" .. "\n"
end
end
end
end
return String
end
local function ShallowCopy(Table)
local Table2 = {}
for Key, Value in pairs(Table) do
Table2[Key] = Value
end
return Table2
end
local Original = ShallowCopy(AK12)
local UnOriginal = AK12
UserInputService.InputBegan:Connect(function(InputBegan)
if InputBegan.KeyCode == Enum.KeyCode.Insert then
Hint.Text = TableEquality(Original, UnOriginal)
print("Insert!")
end
end)
print("Script Ran!")
If you strip everything out of the script apart from the Insert press key detection, it works fine:
local UserInputService = game:GetService("UserInputService")
local Hint = Instance.new("Hint")
Hint.Parent = workspace
UserInputService.InputBegan:Connect(function(InputBegan)
if InputBegan.KeyCode == Enum.KeyCode.Insert then
print("Insert!")
end
end)
print("Script Ran!")
What else is your script supposed to be doing?
Are there any errors in the Output window? Have you tried putting print statements into each function to confirm they are running as expected? Doing that helps to confirm there are no logic problems and you should be able to see at what point it is failing.
What are you trying to evaluate in this block? If you’re are checking to see if the tables are the same, then surely you should have if V == V2 and I == I2 then instead of if V ~= V2 and I == I2 then, yes? If you are looking for discrepancies, you aren’t going to find them unless you change some part of the tables before evaluating them since they start as copies of one another.
If you’re getting any sort of error message, it’s in the AK12 module, since everything you posted beyond that runs without problem.