Ad
Log in to vote
0

RejectedAffection is not a valid member of Lighting ??

Asked by 2 months ago
local Plow = script.Parent.Parent.plow

script.Parent.ChildAdded:connect(function(child)
    if child:IsA("Weld") then       
        player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
        print ("Got Driver")
        print (player)
        wait()
    else
        print ("ERROR")
    end
end)



Plow.Touched:connect(function(hit)
    if hit.Name == "Seed" and hit.Transparency == 0 then
        print("Conencted")
        player.leaderstats.Seeds.Value = player.leaderstats.Seeds.Value + 1
        local oof = player.Name
        hit.Parent.Parent = game.Lighting(oof)

    else
        print("Not Seed")
    end

    if hit.Name == "Wheat" then
        print("Is Wheat")
    end 

end)

Error - RejectedAffection is not a valid member of Lighting

Basically I have these Models of wheat plants that include their lifespan so several blocks and this is a script from my Plow which is supposed to move that whole Model (which there are several of) to a folder with your in game name that is located in Lighting

0
where is the script located abnotaddable 712 — 2mo
0
'game.Lighting(oof)' is calling 'game.Lighting' as a function. To index, you use brackets: '[', ']'. But you shouldn't store things in Lighting anyways! Use ServerStorage or ReplicatedStorage. Goulstem 7591 — 2mo

Hi.

Looks like you're using an ad blocker.

That's fine...

No, it really is.

Just, I mean, we put a lot of work into this site, you know?

It would be really really appreciated if you would turn off your ad blocker for our website...

We tried really hard to make our ads as unobtrusive as possible.

If you really hate ads, would you consider a $2 donation via Patreon?

Here's the link.

We love you. We hope you love us too.

.

..

...

Now back to your regularly scheduled Scripting Helpers....

...

..

.

1 answer

Log in to vote
0
Answered by 2 months ago

Try using :FindFirstChild()

local Plow = script.Parent.Parent.plow

script.Parent.ChildAdded:connect(function(child)
    if child:IsA("Weld") then       
        player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
        print ("Got Driver")
        print (player)
        wait()
    else
        print ("ERROR")
    end
end)



Plow.Touched:connect(function(hit)
    if hit.Name == "Seed" and hit.Transparency == 0 then
        print("Conencted")
        player.leaderstats.Seeds.Value = player.leaderstats.Seeds.Value + 1
        local oof = player.Name
        hit.Parent.Parent = game.Lighting:FindFirstChild(oof) --//Right here

    else
        print("Not Seed")
    end

    if hit.Name == "Wheat" then
        print("Is Wheat")
    end 

end)
0
@mineloxer , thank you. It worked, not sure why I didn't think of this before RejectedAffection 1 — 2mo
1
Woah, mineloxer I actually stumbled onto your youtube channel somehow.. SkeleLordGameR RejectedAffection 1 — 2mo
0
Oh, welcome :D Mineloxer 90 — 2mo
0
or just simply `game.Lighting[oof]` creeperhunter76 378 — 2mo
0
@creeperhunter The above works, and is more readable for beginners. Mineloxer 90 — 2mo
Ad

Answer this question



Ad