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

Follow-up question to "Touching part not making BillboardGUi show up?"

Asked by 4 years ago

So, the script from the other post works (https://scriptinghelpers.org/questions/116927/touching-part-not-making-billboardgui-show-up) but now it shows the terminate text even when you're on a different team. Can someone help please?

1 answer

Log in to vote
0
Answered by 4 years ago

Error Script:

terminateArea.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid")then
        local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
        if hit.Parent:FindFirstChild("Head").TerminateGui.TerminateText.Visible == false then
            if game.Players.GetPlayerFromCharacter(hit.Parent).Team == ExecuteTeam then
            end 
            hit.Parent:FindFirstChild("Head").TerminateGui.TerminateText.Visible = true -- this line of code is supposed to be in the last "if" statement I assume
        end
    end
end)

Fixed Script:

terminateArea.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid")then
        local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
        if hit.Parent:FindFirstChild("Head").TerminateGui.TerminateText.Visible == false then
            if game.Players.GetPlayerFromCharacter(hit.Parent).Team == ExecuteTeam then
                hit.Parent:FindFirstChild("Head").TerminateGui.TerminateText.Visible = true -- Intended placement
            end
        elseif hit.Parent:FindFirstChild("Head").TerminateGui.TerminateText.Visible == true then
            if game.Players.GetPlayerFromCharacter(hit.Parent).Team ~= ExecuteTeam then
                hit.Parent:FindFirstChild("Head").TerminateGui.TerminateText.Visible = false -- make the gui invisible if the visibility is set to true and the player is not on the "execute" team
            end
        end
    end
end)
0
It works, but on line 09 and 05 it says that it expected ":". but either way, thanks! TheStarWarsMaster856 12 — 4y
0
I copied the script in ur post xD, sry I didnt check properly guest_20I8 266 — 4y
Ad

Answer this question