Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How does it have to work on a published game? [SOLVED]

Asked by 6 years ago
Edited 6 years ago

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
0
Is your game Filtering Enabled? Le_Teapots 913 — 6y
0
Where do I check filtering? Krolaer 6 — 6y
0
In your Explorer, click Workspace and check in the Properties tab. cgk255 2 — 6y
0
It works! Thank you. Krolaer 6 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Solved in the comment section.

Ad

Answer this question