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

Why wont my script work to make the team name become the player?

Asked by 9 years ago

I will accept another method of doing this

I tried using ChildAdded for the team first but Their doesn't appear to be players being listed in the Team folder?

I decided to use a script that will start on touch of a part that the player will spawn and walk on. No one else can reach it minus said player. The script is inside of the team, not the part; plus there is a script that is inside of the part you'll have to touch that also has the touched function inside. Here's the script inside of the Team.

DB = false
game.Workspace.NameDetector1.Touched:connect(function(Hit)
    if DB == false then DB = true
        script.Parent.Name = Hit.Parent.Name
        wait(0.1)
        DB = false
    end
end)

Hierarchy appears to be correct.

0
Also, is there a way to fix my Reputation? I have been trolled by someone and basically all my Questions have -1. I had nearly 40 Rep. Can nothing be done for this? alphawolvess 1784 — 9y
0
alpha, report this to kinetic. I know about 5 people who had the same problem. EzraNehemiah_TF2 3552 — 9y
0
You mean Kenetec, Lol. Took a bit to find the person you meant with the wrong name. Ty, will do. alphawolvess 1784 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Scripts do not run under Services other than Workspace or ServerScriptService. Instead, create a script on a brick:

db = false
script.Parent.Touched:connect(function(hit)
    if not db then  
        if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
            plr = game.Players:GetPlayerFromCharacter(hit.Parent)
                if plr then
                    db = false
                    game.Teams.YOURTEAMNAMEHERE.Name = plr.Name
                    wait(1)
                    db = true
                end
            end
        end
    end
end)
Ad

Answer this question