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

This is very odd. . .?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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:

function CC(hit)
        if game.Players:FindFirstChild(hit.Name) then
            local p = game.Players:FindFirstChild(hit.Name)
            if p:FindFirstChild("TS") then
                if p.TS.Value == false then
                    p.TS.Value = true
                    script.Parent.CanCollide = false
                    local O = script.Parent.Parent.Parent.Owner
                    O.Value = p
                    script.Parent.Parent.Name = "Taken: "..p.."."
                    script.Parent.Parent.Parent.RG.Disabled = false
            end
        end
    end
end
script.Parent.Touched:connect(CC)
0
Guys, I forgot to say "Hit.Parent.Name", FOrget it XD CoffeeMesh 5 — 9y

1 answer

Log in to vote
0
Answered by
hudzell 238 Moderation Voter
9 years ago
function CC(hit)
    if hit.Parent:FindFirstChild("Humanoid") then --Fixed checking if it's a player that touched it
        local p = game.Players:GetPlayerFromCharacter(hit.Parent) --:GetPlayerFromCharacter() is much better than your method.
        if p:FindFirstChild("TS") then
            if p.TS.Value == false then
                p.TS.Value = true
                script.Parent.CanCollide = false
                local O = script.Parent.Parent.Parent.Owner
                O.Value = p
                script.Parent.Parent.Name = "Taken: ".. p.Name .."." --Added p.Name and spaces
                script.Parent.Parent.Parent.RG.Disabled = false
            end
        end
    end
end
script.Parent.Touched:connect(CC)
0
Spaces aren't needed for that. EzraNehemiah_TF2 3552 — 9y
0
Yeah i fixed it. still using "Find First Child" Method though. CoffeeMesh 5 — 9y
Ad

Answer this question