it's underlines end) I don't know whats wrong
local CFrameTester = script.Parent
if script.Parent.Parent.Tester1.Touched:Connect(function()
print("it worked!")
end)
it's underlines end) I don't know whats wrong
local CFrameTester = script.Parent
if script.Parent.Parent.Tester1.Touched:Connect(function()
print("it worked!")
end)
Your mistake was really simple: do NEVER put an if statement if you are making a function. That being said, just remove the if statement and you will be good to go!
local CFrameTester = script.Parent
script.Parent.Parent.Tester1.Touched:Connect(function()
print("it worked!")
end)
This is very simple. So insert a part in the workspace and insert a script in the part and type this
Script
local function onTouch(hit)
print("it worked!")
end
script.Parent.Touched:Connect(onTouch)
Now when you touch it, it will print "It Worked"
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
DO NOT add an if when checking if a part was touched
You didn't call the function. after the end put "
Instead of an if statement use a function. "function partTouched (onTouch)
and then after the function put "script.Parent.Parent.Tester1.Touched:Connect(partTouched)"