Let me tell you a little bit, I see no errors in this, Yet it wont do what i am telling it to do. There is no errors in the outpost, Neither did i state/call something that is "="to nil. So, I don't know you take a look:
01 | function CC(hit) |
02 | if game.Players:FindFirstChild(hit.Name) then |
03 | local p = game.Players:FindFirstChild(hit.Name) |
04 | if p:FindFirstChild( "TS" ) then |
05 | if p.TS.Value = = false then |
06 | p.TS.Value = true |
07 | script.Parent.CanCollide = false |
08 | local O = script.Parent.Parent.Parent.Owner |
09 | O.Value = p |
10 | script.Parent.Parent.Name = "Taken: " ..p.. "." |
11 | script.Parent.Parent.Parent.RG.Disabled = false |
12 | end |
13 | end |
14 | end |
15 | end |
16 | script.Parent.Touched:connect(CC) |
01 | function CC(hit) |
02 | if hit.Parent:FindFirstChild( "Humanoid" ) then --Fixed checking if it's a player that touched it |
03 | local p = game.Players:GetPlayerFromCharacter(hit.Parent) --:GetPlayerFromCharacter() is much better than your method. |
04 | if p:FindFirstChild( "TS" ) then |
05 | if p.TS.Value = = false then |
06 | p.TS.Value = true |
07 | script.Parent.CanCollide = false |
08 | local O = script.Parent.Parent.Parent.Owner |
09 | O.Value = p |
10 | script.Parent.Parent.Name = "Taken: " .. p.Name .. "." --Added p.Name and spaces |
11 | script.Parent.Parent.Parent.RG.Disabled = false |
12 | end |
13 | end |
14 | end |
15 | end |
16 | script.Parent.Touched:connect(CC) |