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

My script is showing a GUI for all players when it should only show for one. Why does it do this?

So here is one of my scripts:

local starblox = game.Teams["Starblox Employee"]

game.Workspace.Starblox.Working.Touched:Connect(function(player)
	if game.Players.LocalPlayer.Team == starblox then
		script.Parent.Enabled = true
		player.Shift.Value = true
		script.Parent.Paycheck.Disabled = false
	end
end)

game.Workspace.Starblox.End.Touched:Connect(function(player)
	if game.Players.LocalPlayer.Team == starblox then
		script.Parent.Enabled = false
		player.Shift.Value = false
		script.Parent.Paycheck.Disabled = true
	end
end)

game.Workspace.Starblox.End1.Touched:Connect(function(player)
	if game.Players.LocalPlayer.Team == starblox then
		script.Parent.Enabled = false
		player.Shift.Value = false
		script.Parent.Paycheck.Disabled = true
	end
end)

game.Workspace.Starblox.End2.Touched:Connect(function(player)
	if game.Players.LocalPlayer.Team == starblox then
		script.Parent.Enabled = false
		player.Shift.Value = false
		script.Parent.Paycheck.Disabled = true
	end
end)

game.Workspace.Starblox.End3.Touched:Connect(function(player)
	if game.Players.LocalPlayer.Team == starblox then
		script.Parent.Enabled = false
		player.Shift.Value = false
		script.Parent.Paycheck.Disabled = true
	end
end)

This script enables another script, which is here:

local starblox = game.Teams["Starblox Employee"]
local player = game.Players.LocalPlayer

while true do
	player.Time.Value = player.Time.Value + 1
	if player.Time.Value == 60 then
		if player.Team == starblox  then
			game.ReplicatedStorage.Paycheck:FireServer()
		end
		player.Time.Value = 0
	end
	wait(1)
end

These scripts are both localscripts. I have changed the code many different times but it still shows for all players. How do I fix this?

1 answer

The touches functions doesn't even check who touched the parts. Btw use a script (Server) to detect touches.

2 comments

0

Oh yeah, I forgot that I used player and not hit.

0

lol

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