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

A part i made supposed to be colllided, can you help me fix it?

So, I'm new to scripting, and I did a script, but it didn't work. Can you guys help me?

function onTouched()
	script.Workspace.MessageBlock1.MessageScript.CanCollide = false
	 wait(14)
	script.Workspace.MessageBlock1.MessageScript.CanCollide = true	
end

Thats the code. plus my goal was making MessageBlock1 to block the player from bypassing it, but when you wait 14 seconds, it is now bypassable.

2 comments

0

Hi.. :D To start off in order for us to help you we're going to need more information on your actual script. What you gave us is referred to as a function, and only a segment of what makes up an actual script. All we see here is a bunch of lines of code that we personally do not know what they do so we can't help you debug this. A few things you can provide us are: The rest of the script so we can

1

Is MessageScript a Script? If it is.. scripts don't have a CanCollide property. Also there is no connection statement in your code. And as for it becoming bypassable again.. lines 3 and 4 are the cause..

1 answer

✓ Accepted answer

Well first things first script.Workspace is not a thing. I think what you are looking for is game.Workspace. Also you need to connect the function to the part. Finally scripts do not have a CanCollide property. The following should work assuming MessageBlock1 is the actual part:

game.Workspace.MessageBlock1.Touched:connect(function()
	game.Workspace.MessageBlock1.CanCollide = false
     	wait(14)
   	game.Workspace.MessageBlock1.CanCollide = true 
end)

1 comment

0

Thank you very much wesleyd1124! Im pretty new to scripting!

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