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

Attempt to get length of a Instance value?

Asked by 3 years ago
Edited 3 years ago

I just got this error and I checked if their are typos and their are none, I don't know what I did wrong. I need help, thanks.

local owner = {"TheCryptic_Dude"}

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
        for i = 1, #player do
            if owner[i] == player.Name then
                local trail = game.ServerStorage.Trail:Clone()
                trail.Parent = char.Head
                local attachment0 = Instance.new("Attachment",char.Head)
                attachment0.Name = "TrailAttachment0"
                local attachment1 = Instance.new("Attachment",char.HumanoidRootPart)
                attachment1.Name = "TrailAttachment1"
                trail.Attachment0 = attachment0
                trail.Attachment1 = attachment1

            end
        end
    end)
end)
0
Isn't Line 5 supposed to be "for i = 1, #owner do"? Y_VRN 246 — 3y
0
The Player parameter is referring to the Player Object of the newly connected Client~~ Ziffixture 6913 — 3y
0
Adding onto what Ziff said, player is an object, NOT a table, you cant iterate it. DinozCreates 1070 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

use string.len to get the length of the string!

Ad

Answer this question