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

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

Asked by 2 years ago

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)
0
Is there anything in the output? NotFrindow 346 — 2y

1 answer

Log in to vote
1
Answered by 2 years ago

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)
0
It works! thank you :D imnotaguest1121 362 — 2y
Ad

Answer this question