Ive Been Working On A Simulator And I Have A Script That Keeps Duplicating And IVe Tried So Many Things But Nothing Has Worked
Code:
local serverstorage = game:GetService("ServerStorage") local Debounce = false game.Players.PlayerAdded:Connect(function(player) if Debounce == false then Debounce = true local datafolder = Instance.new("Folder") datafolder.Name = player.Name datafolder.Parent = serverstorage.RemoteData print("Created") local Debounce = Instance.new("BoolValue") Debounce.Name = "Debounce" Debounce.Parent = datafolder Debounce = false end end)
Thanks For Helping
On line 2, you assign Debounce
to a boolean
. Meaning that it is either true
, false
, or nil
.
On line 13 however, you assign Debounce
to a instance
.
And then on line 16 you attempt to assign a boolean
to an instance
which is IMPOSSIBLE.
You want to access the Value
property of Debouce
, like so
Debounce.Value = false;
Final code, edited:
local serverstorage = game:GetService("ServerStorage") local Debounce = false game.Players.PlayerAdded:Connect(function(player) if Debounce == false then Debounce = true local datafolder = Instance.new("Folder") datafolder.Name = player.Name datafolder.Parent = serverstorage.RemoteData print("Created") -- i'd like to heavily stress that below is not required local Debounce = Instance.new("BoolValue") Debounce.Name = "Debounce" Debounce.Parent = datafolder Debounce.Value = false end end)
Also, you do not need to capitalise the first letter of each word!