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

Why Isn't my tool making the player say different phrases?

So I made a tool that whenever you click It, a script forces a player to say a random phrase however It appears that Its not appearing whenever the tool Is clicked, this Is the script:

local tool = script.Parent
local phrases = {
	"Test!"
}

tool.Activated:Connect(function()
	game:GetService("Chat"):Chat(script.Parent.Parent.Parent.Head, phrases[math.random(1, #phrases)], Enum.ChatColor.White)
end)

1 comment

0

Is there anything in the output?

1 answer

✓ Accepted answer

I think you meant

local tool = script.Parent
local phrases = {
    "Test!"
}

tool.Activated:Connect(function()
    game:GetService("Chat"):Chat(script.Parent.Parent.Head, phrases[math.random(1, #phrases)], Enum.ChatColor.White)
end)

Since if you put a extra .Parent, you would reference the Workspace.

or if it is a local script, try

local tool = script.Parent
local phrases = {
    "Test!"
}

tool.Activated:Connect(function()
    game:GetService("Chat"):Chat(game.Players.LocalPlayer.Character.Head, phrases[math.random(1, #phrases)], Enum.ChatColor.White)
end)

1 comment

0

It works! thank you :D

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