|
| 15 May 2013 07:56 AM |
I have a teleport script, but to use it.. you'll need 50 coins.. No matter what I put in this script.. it wont take 50 coins away without breaking the teleporters.. Can someone please help me and tell me what to fix, add, etc.. to make it so it works the way I want it to?
modelname="teleporter1b"
function onTouched(part) if part.Parent ~= nil then local h = part.Parent:findFirstChild("Humanoid") if h~=nil then local teleportfrom=script.Parent.Enabled.Value if teleportfrom~=0 then if h==humanoid then return end local teleportto=script.Parent.Parent:findFirstChild(modelname) if teleportto~=nil then local torso = h.Parent.Torso local location = {teleportto.Position} local i = 1
local x = location[i].x local y = location[i].y local z = location[i].z
x = x + math.random(-1, 1) z = z + math.random(-1, 1) y = y + math.random(2, 3)
local cf = torso.CFrame local lx = 0 local ly = y local lz = 0
script.Parent.Enabled.Value=0 teleportto.Enabled.Value=0 torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz)) wait(3) script.Parent.Enabled.Value=1 teleportto.Enabled.Value=1 else print("Could not find teleporter!") end end end end end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
|
| 15 May 2013 08:37 AM |
| Wait, you can't just check the parent of the part that touched the teleporter, then find the Value from there? What do you mean when you say it breaks the script? Where is the Value located? |
|
|
| Report Abuse |
|
|
|
| 15 May 2013 09:04 AM |
@Zkiller11: The Value is in the same place as the model.. and when I say the script breaks I mean I edit the script.. the teleporter doesn't work..
I must be missing something.. :/ |
|
|
| Report Abuse |
|
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
|
| 15 May 2013 09:27 AM |
| The model? What are you trying to teleport? I figured you were trying to teleport a Player, and the Value was inside the player.. |
|
|
| Report Abuse |
|
|
|
| 15 May 2013 09:39 AM |
I'm trying to teleport the player to another area.. The script works and does the job.. but when I try to make it so the player needs 50 coins to teleport and when they teleport it takes 50 coins away.. the teleporting breaks even if i have enough coins.. even without coins it breaks as well..
P.S. I'm going to be gone for a few hours so expect a late reply..
|
|
|
| Report Abuse |
|
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
|
| 15 May 2013 09:45 AM |
And you tried something like
if player.Value == 50 then -- Teleport player.Value == player.Value - 50
? |
|
|
| Report Abuse |
|
|
usabiker
|
  |
| Joined: 08 Oct 2009 |
| Total Posts: 2098 |
|
| |
|
|
| 15 May 2013 04:19 PM |
@Zkiller11: I'll give that a try then tell you the results..
@usabiker: This isn't OT.. |
|
|
| Report Abuse |
|
|
|
| 15 May 2013 04:37 PM |
Nope.. didn't do anything...
also, bumping thread |
|
|
| Report Abuse |
|
|
|
| 15 May 2013 05:15 PM |
bumping once again... Is it impossible to do? |
|
|
| Report Abuse |
|
|
|
| 15 May 2013 05:57 PM |
| Final bump and I'm just gonna end up giving up on this if no one helps me... |
|
|
| Report Abuse |
|
|
| |
|
|
| 15 May 2013 06:13 PM |
| Says this "18:12:12.517 - Workspace.Tele bricks.teleporter1a.Script:62: 'end' expected (to close 'if' at line 17) near 'eof" |
|
|
| Report Abuse |
|
|
| |
|
|
| 15 May 2013 07:12 PM |
modelname="teleporter1b"
function onTouched(part) if part.Parent ~= nil then local h = part.Parent:findFirstChild("Humanoid") if h~=nil then local teleportfrom=script.Parent.Enabled.Value if teleportfrom~=0 then if h==humanoid then return end local teleportto=script.Parent.Parent:findFirstChild(modelname) if teleportto~=nil then local torso = h.Parent.Torso local location = {teleportto.Position} local i = 1
local x = location[i].x local y = location[i].y local z = location[i].z
x = x + math.random(-1, 1) z = z + math.random(-1, 1) y = y + math.random(2, 3)
local cf = torso.CFrame local lx = 0 local ly = y local lz = 0
script.Parent.Enabled.Value=0 teleportto.Enabled.Value=0 torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz)) wait(3) script.Parent.Enabled.Value=1 teleportto.Enabled.Value=1 else print("Could not find teleporter!") end end end end end end script.Parent.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
|
| 15 May 2013 07:27 PM |
This is the same script I posted.. I need help adding a way so it teleports them if they have 50 coins and takes 50 coins from them.. If no one is going to read the first post, then why did I even bother asking for help.. |
|
|
| Report Abuse |
|
|
|
| 15 May 2013 07:29 PM |
no it's not the same exact script as your first post you moron why don't you just try it stubborn crap |
|
|
| Report Abuse |
|
|
|
| 15 May 2013 07:40 PM |
I tried it.. The teleporters broke.. Thanks, also I want to apologize.. I yelled at you when you're only trying to help.. I'm just frustrated that I can't get this to work |
|
|
| Report Abuse |
|
|
| |
|
|
| 15 May 2013 08:29 PM |
| i apologize for becoming an ass for a few seconds |
|
|
| Report Abuse |
|
|
|
| 16 May 2013 03:58 AM |
@masterblokz: Apology accepted.. So, do you think there could be a way to have it so it costs 50 coins to use the teleport? |
|
|
| Report Abuse |
|
|
me6666me
|
  |
| Joined: 30 Aug 2011 |
| Total Posts: 698 |
|
|
| 16 May 2013 04:43 AM |
Let meh fix it up a bit
tele = "TeleporterB" function touch(hit) local Trso = hit.Parent.Torso if (Trso~=nil) then Trso.CFrame = game.workspace:FindFirstChild(tele).CFrame+Vector3.new(0, 3, 0) local playerz = game.Players:FindFirstChild(Trso.Parent) playerz.leaderstats.Coins.Value = playerz.leaderstats.Coins.Value-50 end
One way tele... >:D |
|
|
| Report Abuse |
|
|
|
| 16 May 2013 06:33 AM |
@me6666me: You forgot one more "end" at the end.. but still.. It didn't work.. Thanks for helping though |
|
|
| Report Abuse |
|
|
|
| 16 May 2013 07:24 AM |
function ot(part) plr = game.Players:GetPlayerFromCharacter(part.Parent) if plr ~= nil then plrstats = plr:FindFirstChild("leaderstats").Points if plrstats ~= nil and plrstats.Value >= 50 then plr.Character:MoveTo(puturpathhere like game.Workspace.Part.Position <-- position is needed) else end end end
|
|
|
| Report Abuse |
|
|
|
| 16 May 2013 07:25 AM |
forgot to connect
function ot(part) plr = game.Players:GetPlayerFromCharacter(part.Parent) if plr ~= nil then plrstats = plr:FindFirstChild("leaderstats").Points if plrstats ~= nil and plrstats.Value >= 50 then plr.Character:MoveTo(puturpathhere like game.Workspace.Part.Position <-- position is needed) else end end end
script.Parent.Touched:connect(ot) |
|
|
| Report Abuse |
|
|