Im making a sort of Capturing/Domination team game where to win you have to stay in the “Capture” zone for as long as possible to gain points for your team.
The issue is that the Capturing script works completely fine but whenever you drop any sort of bomb in the area it stops Capturing the area. The “In Game” solution is pretty simple because all you have to do is just exit and re-enter the “Capture” zone but i really don’t want players to get frustrated of doing this over time
Screenshots:
(Look at the “Capturing” leaderstat in the top right corner)
I’ve tried to make it so that when the bomb runs the “Destroy” function it makes the capturing leaderstat = 1 but i wasn’t able to identify the players leaderstats folder Because the workspace version of the player which most bombs and stuff use doesn’t contain the leaderstats folder.
local team = script.Parent
local flag = script.Parent.Parent.Flag
local pole = script.Parent.Parent.Pole
function onTouch(hit)
local user = game.Players:GetPlayerFromCharacter(hit.Parent)
if user ~= nil then
user.leaderstats.Capturing.Value = 1
end
end
function offTouch(hit)
local user = game.Players:GetPlayerFromCharacter(hit.Parent)
if user ~= nil then
user.leaderstats.Capturing.Value = 0
end
end
script.Parent.Touched:Connect(onTouch)
script.Parent.TouchEnded:Connect(offTouch)
Script inside StarterPlayerScripts
local plr = game.Players.LocalPlayer
while wait(0.5) do
if plr.leaderstats.Capturing.Value == 1 then
plr.leaderstats.Points.Value += 1
elseif plr.leaderstats.Capturing.Value == 0 then
plr.leaderstats.Points.Value += 0
end
end
Could you tell us if that happens when placing any type of item or object? Because if it only happens with the bomb, then I would recommend programming your own bomb using current methods, since I see that you use that type of old bomb from Roblox from 2010 that does not have texture and reflects the sky, these types of items use old and obsolete programming methods
By the way, if I remember correctly, I saw a programmer say that region3 was an obsolete method and that there was a better method, I think he was talking about overlaps params or something like that, anyway I don’t know if region3 can serve well in your situation, I don’t know about region3, but if it doesn’t work, also try overlaps params
I have a question, I have a way to fix it but it’s not really fixing it. Basically should I just divide the one big part into 20 small parts so that the bomb would only effect one of those 20 parts or should I not be lazy
I feel like it wouldn’t be very good in terms of optimization, plus each part should have the script that gives points to whoever touches it, right? So I think the player would be earning several points for touching several parts
I think we can add a fake variable name isplayer inside the startercharacterscript and then when the part got touched then check if the parent’s part have isplayer variable
then the programming of the bomb is not the problem, you should make a conditional that verifies that if what the capture touched is a part that is not a member of a character that does not intervene in anything in the code