i added the b's on the beggining coz title was too short. pretty simple but im not sure if i understand what it does. what i mean is something like this
-- script
local abc
-- the rest of the script
and nothing else
i added the b's on the beggining coz title was too short. pretty simple but im not sure if i understand what it does. what i mean is something like this
-- script
local abc
-- the rest of the script
and nothing else
This is used so you can set the data of it afterward. E.g.
--//Variables
local target
This could be used as a turret or gun.
--//Variables
local target
local bullet = game.ServerStorage.Bullet:Clone()
bullet.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
target = hit.Parent
else
target = nil
end
end)
You could use this technique later. E.g. You could make a textbox that shows what the target is
--//Variables
local target
local bullet = game.ServerStorage.Bullet:Clone()
bullet.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
target = hit.Parent.Name
else
target = nil
end
end)
local textBox = script.Parent
if target ~= nil then
textBox.Text = target
else
textBox.Text = "No Target"
end
So basically, the variable will hold the value nil until it has a value and you can then call that variable later in the script.
It is just a placeholder for a value that does not exist yet.
Indeed. It is the equivalence to: local abc = nil
All it is is a variable that you made with no value, but you can change the value of it in a function or an event later.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Pls accept, I took a lot of time in making this explanation
ok thanks and sorry for late accept i was asleep