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

How to successfully script a trapping 'death plate'?

while true do
	
	wait(4)
	script.Parent.BrickColor=BrickColor:("Bright red") 
	wait(0.1)
	script.Parent:CanCollide = false
	wait(4)
	script.Parent.BrickColor=BrickColor:("Lime green")
	wait(0.1)
	script.Parent:CanCollide = true
	wait(0.1)
	
end


What I'm trying to do is to change the colour of the script's parent ( a brick ) and also to make it uncancollided and then reversed in a continuous loop. I don't see why it wouldn't work, so anybody could give me some help on that?

Current output: 18:14:29.211 - Workspace.DisappearingBrick.Script:4: '' expected near '('

3 comments

0

^ color*

1

^ He might not be American

0

I'm British geeza

2 answers

✓ Accepted answer

You don't understand what : is used for.


object:action() means to do some action to object.

If you don't have an action, or you don't have an object, you don't use :, you use .


Properties which you set with = will never use :, only . -- these are not doing actions, it's just some plain ol' property of the object.

BrickColor is not an object. It just holds onto a new constructor that you can get with . as in BrickColor.new("Bright red")

1 comment

0

Thank you. Yes, I don't know why I put :, I think I got mixed up as I'm used to do another type of scripts, if you see what I mean. Thanks, though :)

use script.Parent.BrickColor = BrickColor.new("Bright red")

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