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

PlayerGui.Control:1192: attempt to index nil with 'Position' - Client - Control:1192 ?

Asked by 2 years ago
Edited 2 years ago
1191:  Mouse.Move:Connect(function()    
    wait()
1192:  local Magnitude = (PrimaryPart.Position - Mouse.Hit.p).Magnitude

1194: if InWater and not WhiteList[UI.Hint.Text] and not Stats.CanSwim then
        UI.Hint.Visible = true
        UI.Hint.Text = "Jump or press Q to swim up!"
    elseif Mouse.Target then
        if (Mouse.Target.Parent.Name == "Edible" or Mouse.Target.Parent.Name == "Leaves") and Magnitude <= Stats.Range and (Stats.Diet == "Omnivore" or Stats.Diet == "Herbivore") and not WhiteList[UI.Hint.Text] then
            UI.Hint.Visible = true
            if not Mouse.Target:FindFirstChild("Leaf") then
                if Mouse.Target.Color ~= Color3.fromRGB(255, 176, 0) and Mouse.Target.Color ~= Color3.fromRGB(159, 161, 172) then
                    UI.Hint.Text = "Click to eat."
                else
                    UI.Hint.Text = "cant be eaten in this season"
                end
            else
                UI.Hint.Text = "Click to eat."
            end
        elseif (Mouse.Target.Parent.Name == "Corpse" or Mouse.Target.Name == "Bug" or string.find(Mouse.Target.Name, "Egg") or Mouse.Target.Parent.Name == "Tail") and Magnitude <= Stats.Range and (Stats.Diet == "Omnivore" or Stats.Diet == "Carnivore") and not WhiteList[UI.Hint.Text] then
            UI.Hint.Visible = true
            if Mouse.Target.Parent ~= workspace then
                if Mouse.Target.Parent:FindFirstChild("Meat") then
                    UI.Hint.Text = "Click to eat. ("..Mouse.Target.Parent.Meat.Value ..")"
                end
            else
                if Mouse.Target:FindFirstChild("Meat") then
                    UI.Hint.Text = "Click to eat. ("..Mouse.Target.Meat.Value ..")"
                end
            end




please, help fix this bug.

0
idk how to fix this. Cuz from this problem animation's for model's don't work. xD_imaa 0 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

We would need to see where is PrimaryPart defined, but sometimes can happen that the object of which PrimaryPart was defined could get replaced or deleted. Re-define PrimaryPart at line before 1192.

0
Tysm xD_imaa 0 — 2y
0
PrimaryPart - HumanoidRootPart at model. My game it's like "Dinosaur Survival". But idk why, script don't see PromaryPart. Everything worked fine a couple of months ago. After some time, I decided to continue development and gave an error(attempt to index). Animations on Dinosaurs stopped working. xD_imaa 0 — 2y
Ad

Answer this question