Haven’t looked into the script, but I can see a ServerScript inside a GUI which is usually ran by the client. Have you tried a LocalScript for things not ran by the server?
local Storage = game:GetService("ReplicatedStorage")
local Trade = Instance.new("Model")
Trade.Parent = Storage
local Trading = Storage:WaitForChild("Trading")
local Check = Trading:FindFirstChild(Trade.Name)
local Id = math.random(1, 10000000)
Trade.Name = "Trade"..Id
repeat
if Check then
Id = math.random(1, 10000000)
Trade.Name = "Trade"..Id
Trade.Parent = Trading
local Check = Trading:FindFirstChild(Trade.Name)
else
Trade.Parent = Trading
end
task.wait(0.1)
until not Check
script.Parent.Parent.Value.Changed:Connect(function()
if script.Parent.Parent.Value.Value ~= nil then
Id = script.Parent.Parent.Parent.TradeId.Value
local Trader1 = Instance.new("StringValue")
Trader1.Parent = Trading["Trade"..Id]
Trader1.Name = script.Parent.Parent.Value.Value
local Trader2 = Instance.new("StringValue")
Trader2.Parent = Trading["Trade"..Id]
Trader2.Name = script.Parent.Parent.Parent.Parent.Parent.Name
script.Parent.Parent.Parent.Parent.Fish.Trade.TradeAccept.TradeId.Value = Id
end
end)
Is this what you were trying to achieve? It’s hard to discern the purpose of the script without much context.
Just so you know in the repeat loop “Check” will always evaluate to true so it will cycle infinitely. You’re setting the name of the model named “Trade” and some ID and then checking if a child can be found of that same name in the folder named “Trading” because of this Check will always represent a Boolean value of true and thus the repeat loop will never break.
Again, sorry for being vague. I’m pretty sure I found a solution to this problem, the loop was the culprit and it didn’t allow the rest of the script to function. Thanks for helping.