Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-3

Why isn't this script working?

Asked by 10 years ago

-- Training Commands ----

if msg:lower():sub(1,9) == "Open Door" then a = game.Workspace.Door a.Transparency = 1 a.CanCollide = false end

if msg:lower():sub(1,10) == "Close Door" then a = game.Workspace.Door a.Transparency = 0 a.CanCollide = true end

if msg:lower():sub(1,7) == "Load SFT" then a = game.Lighting.SFT:clone() a.Parent = workspace end

if msg:lower():sub(1,7) == "End SFT" then a = game.Workspace.SFT a:remove() end

if msg:lower():sub(1,15) == "Load Sharks" then a = game.Lighting.Sharks:clone() a.Parent = workspace end

if msg:lower():sub(1,15) == "End Sharks" then a = game.Workspace.Sharks a:remove() end

if msg:lower():sub(1,17) == "Load Ruins" then a = game.Lighting.Ruins:clone() a.Parent = workspace end

if msg:lower():sub(1,17) == "End Ruins" then a = game.Workspace.Ruins a:remove() end

(This is a part of an admin script of a group's training holo)

2 answers

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
10 years ago

Your script isn't working because the message will never match up. You said

if msg:lower() == "Capitol Letters" then

msg:lower() would convert the whole message into lowercase, so trying to make an equality of lowercase letters to uppercase will never work.

if msg:lower():sub(1,9) == "open door" then a = game.Workspace.Door a.Transparency = 1 a.CanCollide = false end

if msg:lower():sub(1,10) == "close door" then a = game.Workspace.Door a.Transparency = 0 a.CanCollide = true end

if msg:lower():sub(1,7) == "load sft" then a = game.Lighting.SFT:clone() a.Parent = workspace end

if msg:lower():sub(1,7) == "end sft" then a = game.Workspace.SFT a:remove() end

if msg:lower():sub(1,15) == "load sharks" then a = game.Lighting.Sharks:clone() a.Parent = workspace end

if msg:lower():sub(1,15) == "end sharks" then a = game.Workspace.Sharks a:remove() end

if msg:lower():sub(1,17) == "load ruins" then a = game.Lighting.Ruins:clone() a.Parent = workspace end

if msg:lower():sub(1,17) == "end ruins" then a = game.Workspace.Ruins a:remove() end

"a" ~= "A"

Ad
Log in to vote
0
Answered by 10 years ago

Maybe it's because you use msg:lower() which means thee == should be in all lower case aswell or it would compare a automatically lowered text to your's which isnt.

Thumbs up if this helps.

Answer this question