Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is my Script impacting other players?

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)

1 answer

try using a local script. I think the problem is if you are using a normal script. a local script only works for one person.

2 comments

0

Okay, but how can I do this in practice?

0

just think before you insert a script. do you want it to only apear for one person.

This discussion is preserved as it was. New answers, comments, and votes are closed.