Spawn-point that can be disabled through damage

I am in the process of making some sort of Laser Tag game. It requires there to be enemy spawns that can be disabled upon taking enough damage. Here is what I have now-


Keep in mind that I’m new to scripting. All help is appreciated. Thanks!
Im slightly stumped of how to do this, but the example script is something along the lines of what Im looking for.

Could you give us an example how your concept works?

You could but a BoolValue in each spawn and check its .Value property and if its false the spawn is disabled and if true its not.

1 Like

On the second line, maybe write Humanoid.MaxHealth instead of humanoid.MaxHealth

Also, on the third line, it should be if Humanoid.Health => 50 then

And add on the 5th line the end

Hope that helps

So basically the idea is that the opposing team has bases. You can shoot these bases, and once they’ve been shot enough a spawn point for their team is disabled. I’m trying to use a humanoid to record the damage (I don’t know if this is the right way or not).

But, why make the effort to make an extra BoolValue if the MaxHealth propertie is a thing? It‘s like making a ColorValue while there is already a Color propertie on the Part

Why record it, if you can read the Health propertie? May you explain more?

1 Like

You’ll want to react every time the base takes damage, and then check if the health is below or at 0. If that’s the case you can set the Enabled property of SpawnLocation to false, which should disable it from working.

But also adding some loop. Else it will just run once (when the Humanoid has full Health) and it won‘t work (because it already ran once)

I’m not exactly sure what way to do it, but I thought if I just used a humanoids health to like hold the health for the base and recognise damage being taken?
Sorry for not being well specific.

1 Like

I’ve done that? I believe I just need to fix the script?

Yea, that‘s correct, but you also need to add a loop

trying to explain it in a beginner friendly way, your code will run as soon as the world spawns, but then it won‘t ever work afterway. Also, you should insert the code in the ServerScriptService. Leaving it in the workspace will allow hackers to exploit and delete the script.

If you want the script to be really performant, try events instead of loops (game:GetService(“Players“).PlayerAdded ; this is an event for example)


Its not showing (I snipped it) here but there’s two errors
On the => it says: 'expected then when parsing if statement got ‘=’
And on the then: Expected identifier when parsing expression got ‘then’

Ok thank you. I didn’t realise that.

1 Like

my bad, it‘s >=, not =>. Hope that helps

You are welcome

Thanks a lot! I will come back to this tomorrow, as its past midnight for me… I truly appreciate everyone’s help in aiding me to make my dreams come true!:grinning:

1 Like
local Humanoid = script.Parent:FindFirstChild("Humanoid")
local SpawnPoint = workspace:FindFirstChild("SpawnPoint")

Humanoid.HealthChanged:Connect(function(Health)
	if Health <= 50 then
		SpawnPoint.Enabled = false
	end
end)

https://developer.roblox.com/en-us/api-reference/event/Humanoid/HealthChanged

While that is certainly a way to help, you should never give a new scripter a code to copy-paste. The goal of a topic is to help the scripter finding a solution + understand the new found solution. By just giving him the code without explaining anything, you aren‘t really helping @Ckicken_KId.

Also, same thing as I told before, this should be in the ServerScriptService, not in the player‘s Character Model

It’s an NPC, so the script is fine inside the model itself. You’re right about providing more info regarding potential solutions so I’ve linked the HealthChanged event article.

1 Like

But if the script is there, then a hacker could easily modify it. Everything that‘s in the workspace can be manipulated (If I remember right)

Nevermind, guess I am just a boomer now (haven‘t been active on the forum until now)
https://developer.roblox.com/en-us/api-reference/property/Workspace/FilteringEnabled

Forget what I said, I guess

I agree with you there about me learning. But hey, I’m not going to complain.

1 Like