|
| 16 Mar 2007 10:48 AM |
Hi, I need a bit of help here. I'm trying to make a lap counter, which will count how many laps the player has done in my new Agility course. This is what I came up with so far:
function onTouched(part) local stats = part.Parent:findFirstChild("leaderstats") if stats ~= nil then local laps = stats:findFirstChild("Laps") laps.Value = laps.Value + 1
script.Parent.Touched:connect(onTouched)
I know something isn't right with it, because it won't work, lol. Can anyone fill me in on what I'm doing incorrect here?
Pilot |
|
|
| Report Abuse |
|
|
|
| 16 Mar 2007 10:55 AM |
Oh yeah, I had asked a question earlier about setting messages to be seen only by the player touching the brick. This is what I came up with so far as well:
tele = script.Parent.TeleportBrick
local debounce = false
message = nil function showMessage(text)
hideMessage() message = Instance.new("Message") message.Text = text message.Parent = game.Players.LocalPlayer end
function hideMessage() if message == nil then return end message.Parent = nil end
function TalkToPlayer(player)
debounce = true
showMessage("Welcome to the Arena!") wait(3) showMessage("Due to heavy construction") wait(2) showMessage("my Arena is closed until") wait(2) showMessage("construction is complete.") wait(3) showMessage("But go ahead and enjoy the lobby lol!") wait(4) showMessage("Best wishes from Pilot.") wait(5) message.Parent = nil
debounce = false end
function onTouch(touchedPart) print("touched") local parent = touchedPart.Parent if parent~=nil then local humanoid = parent:findFirstChild("Humanoid", false); if humanoid ~= nil and debounce == false then TalkToPlayer(game.Players.LocalPlayer) return end end end
print(tele)
tele.Touched:connect(onTouch)
Now this script runs perfectly fine on solo, but not multiplayer. I'm trying to figure out how to make it run on multiplayer mode. Any help with this also is highly appreciated. Best!
Pilot |
|
|
| Report Abuse |
|
|
|
| 16 Mar 2007 04:29 PM |
Are you just trying to make a brick that, when touched, will increment a lap counter? I'm not sure if that would be enough to enforce a race-track type system. People could just touch the brick a lot of times and score laps that way.
Anyways, I figured out how to add counters to my WWC map by studying the scripts in NukeTheWhale's place and in the Christmas map (I think the account is MerryChristmas, I don't remember). The Christmas map has a custom Presents counter that goes up whenever you touch a present brick. It's basically the same thing you want to do.
The short answer is, if you modify any existing leaderboard script to stick additional IntValues under the leaderstats object it creates, you will see additional columns on the leaderboard.
For your 2nd question, from looking at the BattleArmor script (in my place or in Glass Houses), I learned that you can show a message to a single player by sticking the Message object under the right Player object, rather than putting it in the Workspace.
Does any of that make sense? Maybe MrDoom will chime in here, he's been dealing with this stuff longer than I. |
|
|
| Report Abuse |
|
|
k9chief
|
  |
 |
| Joined: 13 Oct 2006 |
| Total Posts: 7238 |
|
|
| 16 Mar 2007 06:46 PM |
| UHHHHHHH...... Dont look at me lol |
|
|
| Report Abuse |
|
|
| |
|
| |
|