Hello again I'm doing a block as if it were a training area doubles my stats after entering, although I'm using Region3, when I enter my stats multiply, but those of other players multiply as well. How do I fix this?
The Script:
local Players = game:GetService("Players")
local Region = Region3.new(script.Parent.Position - (script.Parent.Size / 2), script.Parent.Position + (script.Parent.Size / 2))
local function scanForPlayerInRegion(Player)
local Parts = workspace:FindPartsInRegion3WithWhiteList(Region, Player.Character:GetDescendants())
if(#Parts >= 1)then
return true
else
return false
end
end
spawn(function()
while(wait(1/60))do
for _,Plr in next,Players:GetPlayers()do
if(not(Plr.Character))or(not(Plr))then continue end --------- The line checks when player is on the part
if(scanForPlayerInRegion(Plr))then
print("Player was on the part!")----------------
game.ReplicatedStorage.Training = 1000000 ---- The Training is IntValue
else
print("Player was out the part!")-------------- The line detects the player out the part.
game.ReplicatedStorage.Training = 1000
end
end
end
end)

2 comments
Okay, but how can I do this in practice?
just think before you insert a script. do you want it to only apear for one person.