Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[Solved] Cloning reapting fixing the error maybe someone know why ?

Hello everyone,

I'm trying to clone a folder i try to find the error editing and editing and editing but i can't find it

Workspace.Part.Script: Line12: attempt to index a nil value

db = false

script.Parent.Touched:connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
		if db == false then
			db = true
warn("Player: " ..plr)			
			script.Parent.BrickColor = BrickColor.new("Bright red")
			plr.playerdata.Crowns.Value = plr.playerdata.Crowns.Value + 2
			
    		game.Lighting.Animation.Crowns:Clone().Parent = game.Players:FindFirstChild(plr):FindFirstChild("PlayerGui")
			game.Players:FindFirstChild(plr):FindFirstChild("PlayerGui").Crown.TextLabel.Text = "+ 2"	

			wait(2)
			script.Parent.BrickColor = BrickColor.new("Bright green")
			db = false
		end
	end
end)

Cockerel's Arshyheute um 11:19 Uhr Just do plr.PlayerGui

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.