A function is a set-aside scope of instructions for the Lua Compiler to execute when called upon. This of which you did not do. To call a function, you must write it's handle alongside the arugmental parentheses:
function onButtonClicked()
Brick.CanCollide = false
Brick.Transparency = 1
end
onButtonClicked()
However, even though this will solve the issue above, to use this is entirely unnecessary, as we can simply just have the two instructive lines run automatically when the conditional—if statement—proves True.
With that out of the way, your issues still do not stop here. You're missing several closures to multiple scopes, which will toss a load EOF exceptions, ensure to use the end keyword where necessary, though Intellisense should've already put these measures in place when programming, including automatic indentation. There are also some deprecated methods such as lowercase :connect().
local Players = game:GetService("Players")
local FindWords = {"Word"}
local Birck = workspace.Part
Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(ChatMessage)
for _,Word in pairs(FindWords) do
if (ChatMessage:lower():find(Word:lower())) then
Brick.CanColide = false
Brick.Transparency = 1
end
end
end)
end)
3 comments
is there any error?
Is this code your own?
Is it that sloppy? ^