What I wanted to do with this script is whenever you come close enough to the object, you start capturing "the turf". At the same time a gui pops up, which will show who owns it. In studio play it works perfectly, but in a published game, not even the gui pops up, why?
while true do for i,plr in ipairs(game.Players:GetChildren()) do local char=plr.Character if char~=nil then local t=char:FindFirstChild("Torso") local h=char:FindFirstChild("Humanoid") if t~=nil and h~=nil then if h.Health>0 then pos1=t.Position*Vector3.new(1,0,1) pos2=script.Parent.Base.Position*Vector3.new(1,0,1) if (pos1-pos2).magnitude<10 then n=1 plr.PlayerGui:WaitForChild("TurfScreenGui1").Enabled = true else captureprogress=0 n=0 plr.PlayerGui:WaitForChild("TurfScreenGui1").Enabled = false end if n==1 then captureprogress=captureprogress+1 if captureprogress==10 then if plr:IsInGroup(3893650)then group = game:GetService("GroupService"):GetGroupInfoAsync(3893650) plr.PlayerGui:WaitForChild("TurfScreenGui1").GroupName.Text = group.Name plr.PlayerGui:WaitForChild("TurfScreenGui1").Frame.ImageLabel.Image = group.EmblemUrl end if plr:IsInGroup(3862805)then group = game:GetService("GroupService"):GetGroupInfoAsync(3893650) plr.PlayerGui:WaitForChild("TurfScreenGui1").GroupName.Text = group.Name end print("We captured") end end end end end end wait(0.7) end