Here Is My Code
local SMLPart = game.Workspace.Parts.SMLPart local LRGPart = game.Workspace.Parts.LRGPart local Part = {"SMLPart", "LRGPart"} local Hint = Instance.new("Hint") local Random = Part[math.random(#Part)] wait () Hint.Text = Random.. "Has Been Chosen" Random:Destroy()
The Hint Is Not Showing And This Is The Error;
attempt to call method 'Destroy' (a nil value)
That is because you haven't set any objects in the table, but merely Strings. To fix this, just remove the quotation marks:
local SMLPart = game.Workspace.Parts.SMLPart local LRGPart = game.Workspace.Parts.LRGPart local Part = {SMLPart,LRGPart} local Hint = Instance.new("Hint",workspace) local Random = Part[math.random(#Part)] Hint.Text = Random.Name .. "Has Been Chosen" Random:Destroy()
If any other question is lingering in your mind, don't hesitate to comment!
Accept this question if this helped you, so others can know that it can assist them too.
Just remove the quotations and Add how many Parts you want to destroy:
local SMLPart = game.Workspace.Parts.SMLPart local LRGPart = game.Workspace.Parts.LRGPart local Part = {SMLPart,LRGPart}--remove quotations because it is a Variable local Hint = Instance.new("Hint",workspace) local Random = Part[math.random(1 ,#Part)]--How many parts you want to pick randomly Hint.Text = Random.Name .. "Has Been Chosen" Random:Destroy()
if this Helped please Upvote **and **Accept Answer!