0

# {SOLVED}What is wrong with this script?

Asked by 7 years ago

{SOLVED}The following script is supposed to make the part(which the script is in it) to uncheck CanCollide property and make the part's transparency 0 for 5 seconds. Here is the script:

game.Players.PlayerAdded:connect(function(msg)
if Player.msg == "boss" then
CanCollide = false
transparency = 1
while true do
wait(5)
CanCollide = true
transparency = 0
end
end
end


The script is not working, I am new to scripting so you will find lots of mistakes. -Thank you if you answered my question, I will be sure to upvote and accept your answer if it is correct!(SOLVED}

1
Vividex 162
7 years ago

Its just calling the function msg when a player comes in, I might be wrong but I'm thinking that you want the door to take cancollide off and change transparency when someone says "boss", Player.msg doesn't mean if the player says _ word it will do _, it does nothing but error. Plus, your not saying what you want to be CanCollide off and transparency 1, from my view, its a part. I also don't get why you used a while true do which means it will just not let you ever make it cancollide off and transparency 1.

Try this:

--Vividex
local p = game.Workspace.Part --Made the part a variable, easier for me

function onChatted(msg, recipient, Speaker)
if msg == "boss" then
p.CanCollide = false
p.Transparency = 1
wait(5) --waits 5 seconds after saying "boss"
p.CanCollide = true --after 5 seconds changes the parts cancollide to true
p.Transparency = 0 --after 5 seconds changes the parts Transparency to 0
end
end

function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end


0
Thanks a lot! Upvoted and accepted. kudorey619 138 — 7y
0
Answered by 7 years ago

You spelled "CanCollide" wrong.

0
:o That is true LOL! Well...... it is still not working, there's another wrong thing in the script :/ Anyway, thanks for the help. Upvoted! kudorey619 138 — 7y
0
Answered by 7 years ago

there should be two ='s on line 2.

if Player.msg == "boss" then


Powered by Chipio Industries Upvote if this post was useful

0
Well..... It is useful! Actually the output was saying that there's something wrong in line 2, now it is not! BUT still not working. Anyway thanks, upvoted! kudorey619 138 — 7y
0
Wait, I know what's wrong! I'll PM it to you if I can. ChipioIndustries 454 — 7y