Imgflip Logo Icon

pain.

421 views 11 upvotes Made by Flare_The_Fire 2 months ago in Roblox
Minecraft epic fail memeCaption this Meme
15 Comments
0 ups, 2mo,
1 reply
made w/ Imgflip meme maker
The script if anyone's wondering. I'm trying to get the variable to 100 without it happening every click.
0 ups, 2mo,
1 reply
this line in particular causes problems i think.

local Wall_Hp1 = Wall_Hp1 - 20

try like this:

Wall_Hp1 - 20 = Wall_Hp1
0 ups, 2mo,
1 reply
No, that's not the problem I'm encountering. the if then statement doesn't work because Wall_Hp1 is not defined. I'm trying to make the script set Wall hp to 100 without it setting every time, but can't find how.
0 ups, 2mo,
1 reply
oh its simple just define the wall hp variable outside of the click function then reset it after the click changes are made
0 ups, 2mo,
2 replies
or in other words

local Wall_Hp1 = 100
local Brickwall1 = script.Parent
local click = Brickwall1.ClickDetector
local soundplay = game.Workspace.Brickwall1.Sound
click.MouseClick:Connect(function()
Wall_Hp1 -= 20
print(Wall_Hp1)
if Wall_Hp1 <= 0 then
Wall_Hp1 = 100
end
end)

I may have made a mistake since I didn’t write this in studio but hopefully it should work
0 ups, 2mo
Yeah, I've already done that before. The print's outcome is always 80, probably because it's resetting to 100 then subtracting 20. and yes the variable is outside the click function
0 ups, 2mo,
1 reply
Wait nvm your code actually worked thanks
0 ups, 2mo
yw
[deleted]
0 ups, 2mo,
1 reply
1 up, 2mo,
1 reply
I'm resetting it every time it hits 0, it creates an item then goes back to 100.
0 ups, 2mo
ok
0 ups, 2mo,
2 replies
roblox scripting is the only time i am willing to use generative AI
the programming language it uses is utterly incomprehensible and absolute garbage
0 ups, 2mo,
1 reply
I just found out abt scripting school on roblox and I feel like it's gonna help me a lot.
0 ups, 2mo
nice
0 ups, 2mo
nah its easier than most languages
Minecraft epic fail memeCaption this Meme
Created from video with the Imgflip Animated GIF Maker
IMAGE DESCRIPTION:
ME WHEN SCRIPTING: