You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want to code more efficiently so i want to bypass as much variables as possible. It’s a bit complicated to explain but i can try by using this example:
How I would write it currently:
local exampleboolvalue = false
local examplepart = workspace.examplepart
examplepart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if exampleboolvalue == false then --to make it execute just once!
exampleboolvalue = true
--code to be executed
end
end
end)
How I would like to write it:
local examplepart = workspace.examplepart
examplepart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if -a boolvalue just fo this ifstatement which isnt a variable- == false then --to make it execute just once!
--code to be executed
end
end
end)
- What is the issue? Include screenshots / videos if possible!
I have absolutely no idea how to do this because im not the best in coding.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried to search for someone who asked the same question but i dont know how to search for it because its hard for me to explain it in a simple question.
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.