|
I made a script for a readable book. When you click the book, the text in qoutations appear. It only works in Build (Solo) mode, but I need it to work in online mode. I posted the whole script below, so if anyone finds what's wrong, please tell me how to fix it.
function act()
state = not state
if state then
local h = Instance.new("Message")
h.Parent = game.Players.LocalPlayer
h.Text = "~Jeffrey's Journal~"
wait(3)
h.Text = "Day 1:"
wait(3)
h.Text = "I have come across"
wait(2)
h.Text = "a small, uncharted"
wait(2)
h.Text = "island. I don't know"
wait(2)
h.Text = "what is here, or if it"
wait(2)
h.Text = "is dangerous, but I"
wait(2)
h.Text = "feel a need to find"
wait(2)
h.Text = "out."
wait(2.5)
h.Text = "Day 2:"
wait(3)
h.Text = "I have found a small"
wait(2)
h.Text = "corner that seems"
wait(2)
h.Text = "safe, and I've made"
wait(2)
h.Text = "my boat into a table."
wait(2)
h.Text = "Tommorow I plan to"
wait(2)
h.Text = "start a fire and make"
wait(2)
h.Text = "some sort of wall."
wait(2.5)
h.Text = "Day 3:"
wait(3)
h.Text = "I made a fire and"
wait(2)
h.Text = "built a small wall"
wait(2)
h.Text = "out of trees and brush."
wait(2)
h.Text = "This should protect my"
wait(2)
h.Text = "chocolate."
wait(2.5)
h.Text = "Day 4:"
wait(3)
h.Text = "They came during the"
wait(2)
h.Text = "night. They were like"
wait(2)
h.Text = "nothing I've ever seen"
wait(2)
h.Text = "before. They were crazy,"
wait(2)
h.Text = "and had a never dying"
wait(2)
h.Text = "hunger for"
wait(2)
h.Text = "chocolate."
wait(2.5)
h.Text = "Day 5:"
wait(3)
h.Text = "I don't know how"
wait(2)
h.Text = "much longer I can"
wait(2)
h.Text = "survive. I don't have"
wait(2)
h.Text = "much chocolate left, and"
wait(2)
h.Text = "the creatures have"
wait(2)
h.Text = "gotten much bigger."
wait(2)
h.Text = "Now they are about"
wait(2)
h.Text = "the size of my big toe."
wait(2)
h.Text = "I had a nasty encounter"
wait(2)
h.Text = "last night, when I was"
wait(2)
h.Text = "attacked by a group of"
wait(2)
h.Text = "them, and they made a"
wait(2)
h.Text = "high squeel, that made"
wait(2)
h.Text = "scream like a little girl."
wait(2)
h.Text = "I shall call them"
wait(2)
h.Text = "Squeeblings."
wait(2.5)
h.Text = "Day 6:"
wait(3)
h.Text = "I have recorded three"
wait(2)
h.Text = "different types of"
wait(2)
h.Text = "Squeeblings, and found"
wait(2)
h.Text = "that they cannot climb,"
wait(2)
h.Text = "so I can watch them from"
wait(2)
h.Text = "the mountains. The smaller"
wait(2)
h.Text = "ones are about the size of"
wait(2)
h.Text = "my small toe. I call them"
wait(2)
h.Text = "Squeeners. The ones that"
wait(2)
h.Text = "are the size of my big toe"
wait(2)
h.Text = "I call Squeenalings."
wait(2)
h.Text = "An the biggest, most"
wait(2)
h.Text = "horrifying, I call the-"
wait(2)
h.Text = "-The rest is just scribbles-"
wait(2)
h:Remove()
end
end
script.Parent.ClickDetector.MouseClick:connect(act) |
|
|
LocalPlayer doesn't Exist in Online Mode... |
|
SpectrumwJoin Date: 2009-08-04 Post Count: 13510 |
It actually exist, but you can only access to it using LocalScripts. |
|
|
|
|
You can't find the player that clicked the ClickDetector.
I would reccomend using a Touched event so you can find who touched it.
Also, LocalScripts only run in Players, Characters, and Tools/Hopperbins, so it would be pointless to do that. |
|
|
I'll make it a touched event, but it's a book on a table, so if anyone can tell me if there is a way to make it work by clicking, please tell me. |
|
AgentFirefoxTop 100 PosterJoin Date: 2008-06-20 Post Count: 22404 |
Well....
There IS a way....
But it is kinda.... unreliable....
I need to know the name of your brick, though. |
|
KaaarIJoin Date: 2010-09-05 Post Count: 6 |
Maybe you can drive my car! |
|
|
The name of the brick is ZReadable. |
|
|
Kinda late since he logged off... you could try looking for a pseudo clickdetector script in anaminus's models, I think he made one. |
|
AgentFirefoxTop 100 PosterJoin Date: 2008-06-20 Post Count: 22404 |
Try this, I have to go. I'll check back after I get back from school.
lines = {
"~Jeffrey's Journal~",
"Day 1:",
"I have come across",
"a small, uncharted",
"island. I don't know",
"what is here, or if it",
"is dangerous, but I",
"feel a need to find",
"out.",
"Day 2:",
"I have found a small",
"corner that seems",
"safe, and I've made",
"my boat into a table.",
"Tommorow I plan to",
"start a fire and make",
"some sort of wall.",
"Day 3:",
"I made a fire and",
"built a small wall",
"out of trees and brush.",
"This should protect my",
"chocolate.",
"Day 4:",
"They came during the",
"night. They were like",
"nothing I've ever seen",
"before. They were crazy,",
"and had a never dying",
"hunger for",
"chocolate.",
"Day 5:",
"I don't know how",
"much longer I can",
"survive. I don't have",
"much chocolate left, and",
"the creatures have",
"gotten much bigger.",
"Now they are about",
"the size of my big toe.",
"I had a nasty encounter",
"last night, when I was",
"attacked by a group of",
"them, and they made a",
"high squeel, that made",
"scream like a little girl.",
"I shall call them",
"Squeeblings.",
"Day 6:",
"I have recorded three",
"different types of",
"Squeeblings, and found",
"that they cannot climb,",
"so I can watch them from",
"the mountains. The smaller",
"ones are about the size of",
"my small toe. I call them",
"Squeeners. The ones that",
"are the size of my big toe",
"I call Squeenalings.",
"An the biggest, most",
"horrifying, I call the-",
"-The rest is just scribbles-",
}
function act(player)
if not player:FindFirstChild("Book") then
local h = Instance.new("Message", player)
h.Name = "Book"
coroutine.wrap(function()
for _, v in pairs(lines) do
h.Text = v
wait(3)
end
end)()
wait()
h:Remove()
end
end
game.Players.PlayerAdded:connect(function(P)
P.CharacterAdded:connect(function(C)
wait()
C.Humanoid.Changed:connect(function(Prop)
if Prop == "WalkToPart" and C.Humanoid.WalkToPart.Name == "ZReadable" then
pcall(function()
if (C.Humanoid.WalkToPart.Position - C.Torso.Position).magnitude <= 6 then
C.Humanoid.WalkToPart = nil
C.Humanoid.WalkToPoint = C.Torso.Position
act(P)
end
end)
end
end)
end)
end) |
|
ApocalypsJoin Date: 2009-02-15 Post Count: 816 |
That would error! =P you had one ',' too much in the table (at the end)
lines = {
"~Jeffrey's Journal~",
"Day 1:",
"I have come across",
"a small, uncharted",
"island. I don't know",
"what is here, or if it",
"is dangerous, but I",
"feel a need to find",
"out.",
"Day 2:",
"I have found a small",
"corner that seems",
"safe, and I've made",
"my boat into a table.",
"Tommorow I plan to",
"start a fire and make",
"some sort of wall.",
"Day 3:",
"I made a fire and",
"built a small wall",
"out of trees and brush.",
"This should protect my",
"chocolate.",
"Day 4:",
"They came during the",
"night. They were like",
"nothing I've ever seen",
"before. They were crazy,",
"and had a never dying",
"hunger for",
"chocolate.",
"Day 5:",
"I don't know how",
"much longer I can",
"survive. I don't have",
"much chocolate left, and",
"the creatures have",
"gotten much bigger.",
"Now they are about",
"the size of my big toe.",
"I had a nasty encounter",
"last night, when I was",
"attacked by a group of",
"them, and they made a",
"high squeel, that made",
"scream like a little girl.",
"I shall call them",
"Squeeblings.",
"Day 6:",
"I have recorded three",
"different types of",
"Squeeblings, and found",
"that they cannot climb,",
"so I can watch them from",
"the mountains. The smaller",
"ones are about the size of",
"my small toe. I call them",
"Squeeners. The ones that",
"are the size of my big toe",
"I call Squeenalings.",
"An the biggest, most",
"horrifying, I call the-",
"-The rest is just scribbles-"
}
function act(player)
if not player:FindFirstChild("Book") then
local h = Instance.new("Message", player)
h.Name = "Book"
coroutine.wrap(function()
for _, v in pairs(lines) do
h.Text = v
wait(3)
end
end)()
wait()
h:Remove()
end
end
game.Players.PlayerAdded:connect(function(P)
P.CharacterAdded:connect(function(C)
wait()
C.Humanoid.Changed:connect(function(Prop)
if Prop == "WalkToPart" and C.Humanoid.WalkToPart.Name == "ZReadable" then
pcall(function()
if (C.Humanoid.WalkToPart.Position - C.Torso.Position).magnitude <= 6 then
C.Humanoid.WalkToPart = nil
C.Humanoid.WalkToPoint = C.Torso.Position
act(P)
end
end)
end
end)
end)
end) |
|
AgentFirefoxTop 100 PosterJoin Date: 2008-06-20 Post Count: 22404 |
"That would error! =P you had one ',' too much in the table (at the end) "
An extra , at the end doesn't change the outcome in a table. |
|
|
So.. uh.. which one works?
~TheVampWolfGirl~
Being epic for over 6 minutes. |
|
AgentFirefoxTop 100 PosterJoin Date: 2008-06-20 Post Count: 22404 |
Both should work. |
|
|
They didn't work, I'll try that Pseudo Click Detector thing. Also, I didn't quite understand what the "Book" was for, inform me? Thanks for helping so far though. |
|
|
I tried everything, I just can't get it to work. |
|
llmutellJoin Date: 2009-01-21 Post Count: 612 |
You might make it less complex and more interesting my creating a book GUI, the whole thing could be a nice decal, it's easier, simpler, and looks a lot better. |
|
llmutellJoin Date: 2009-01-21 Post Count: 612 |
Further more, you could make a simple "Hand" tool that opens the gui when the "Book" brick is clicked. Like a mystery game. Tools can easly be traced to a player.
Keep it simple.
lMl
|
|
|
I made a tool based tycoon :P but it's not finished yet. All I have is some income upgrades and a start for the actual tycoon thingy. |
|
|
But the reason i dont want to make a GUI out of it is becaue i want to use the same script other things, such as a click on a NPC's head will make it talk to you. |
|