TameDroneJoin Date: 2010-12-09 Post Count: 1006 |
print("VIP Door Script loaded")
GroupId = 355206
function checkOkToLetIn(name)
if game.Players[name]:IsInGroup(GroupId) == true then return true end
return false
end
local Door = script.Parent
function onTouched(hit)
print("Door Hit")
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil ) then
print("Human touched door")
if (checkOkToLetIn(human.Parent.Name)) then
print("Human passed test")
Door.Transparency = 0.7
Door.CanCollide = false
wait(1)
Door.CanCollide = true
Door.Transparency = 0
else human.Health= 0
end
end
end
script.Parent.Touched:connect(onTouched)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
How would I make it so that when it allows someone to come in, it shows up a hint saying the person's name, and then says has entered, for example:
"TameDrone has entered" |
|
TameDroneJoin Date: 2010-12-09 Post Count: 1006 |
..? |
|
|
For what you want to do, you simply need to insert a hint, get the player's name, and add has entered to it.
hint = Instance.new("Hint", workspace)
hint.Text = hit.Parent.Name .. " has entered"
wait(1)
hint.Parent = nil
The full script:
print("VIP Door Script loaded")
GroupId = 355206
function checkOkToLetIn(name)
if game.Players[name]:IsInGroup(GroupId) == true then return true end
return false
end
local Door = script.Parent
function onTouched(hit)
print("Door Hit")
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil ) then
print("Human touched door")
if (checkOkToLetIn(human.Parent.Name)) then
print("Human passed test")
Door.Transparency = 0.7
Door.CanCollide = false
hint = Instance.new("Hint", workspace)
hint.Text = hit.Parent.Name .. " has entered"
wait(1)
hint.Parent = nil
Door.CanCollide = true
Door.Transparency = 0
else human.Health= 0
end
end
end
script.Parent.Touched:connect(onTouched) |
|
TameDroneJoin Date: 2010-12-09 Post Count: 1006 |
I'll try it out, thanks |
|
|
print("VIP Door Script loaded")
GroupId = 355206
function checkOkToLetIn(name)
if game.Players[name]:IsInGroup(GroupId) == true then return true end
return false
end
local Door = script.Parent
function onTouched(hit)
print("Door Hit")
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil ) then
print("Human touched door")
if (checkOkToLetIn(human.Parent.Name)) then
print("Human passed test")
Door.Transparency = 0.7
Door.CanCollide = false
wait(1)
local h = Instance.new("Hint",Workspace)
h.Text = human.Parent.Name .. " has entered"
Game.Debris:AddItem(h,5)
Door.CanCollide = true
Door.Transparency = 0
else human.Health= 0
end
end
end
script.Parent.Touched:connect(onTouched) |
|
|
TameDroneJoin Date: 2010-12-09 Post Count: 1006 |
hint = Instance.new("Hint", workspace)
hint.Text = hit.Parent.Name .. " has entered"
wait(1)
hint.Parent = nil
The full script:
print("VIP Door Script loaded")
GroupId = 355206
function checkOkToLetIn(name)
if game.Players[name]:IsInGroup(GroupId) == true then return true end
return false
end
local Door = script.Parent
function onTouched(hit)
print("Door Hit")
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil ) then
print("Human touched door")
if (checkOkToLetIn(human.Parent.Name)) then
print("Human passed test")
Door.Transparency = 0.1
wait()
Door.Transparency = 0.2
wait()
Door.Transparency = 0.3
wait()
Door.Transparency = 0.4
wait()
Door.Transparency = 0.5
wait()
Door.Transparency = 0.6
wait()
Door.Transparency = 0.7
wait()
Door.Transparency = 0.8
wait()
Door.Transparency = 0.9
wait()
Door.Transparency = 1
wait()
Door.CanCollide = false
hint = Instance.new("Hint", workspace)
hint.Text = hit.Parent.Name .. " has entered"
wait(1)
hint.Parent = nil
Door.CanCollide = true
wait()
Door.Transparency = 0.9
wait()
Door.Transparency = 0.8
wait()
Door.Transparency = 0.7
wait()
Door.Transparency = 0.6
wait()
Door.Transparency = 0.5
wait()
Door.Transparency = 0.4
wait()
Door.Transparency = 0.3
wait()
Door.Transparency = 0.2
wait()
Door.Transparency = 0.1
wait()
Door.Transparency = 0
wait()
else human.Health= 0
hint = Instance.new("Hint", workspace)
hint.Text = hit.Parent.Name .. " has failed to enter"
end
end
end
script.Parent.Touched:connect(onTouched)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I really messed with it this time but I think it will still work unless I made a spelling mistake or something. Will it still work? |
|
|
That would work, except it wouldn't remove the hint. I suggest putting in a wait(1) after the second end, and then removing the hint (Either hint.Parent = nil, or hint:Destroy()).
As well, that's fairly inefficient. You could make it far easier by using for i = 1,0,-0.1 do and for i = 0,1,0.1 do to change the transparency.
hint = Instance.new("Hint", workspace)
hint.Text = hit.Parent.Name .. " has entered"
wait(1)
hint.Parent = nil
The full script:
print("VIP Door Script loaded")
GroupId = 355206
function checkOkToLetIn(name)
if game.Players[name]:IsInGroup(GroupId) == true then return true end
return false
end
local Door = script.Parent
function onTouched(hit)
print("Door Hit")
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil ) then
print("Human touched door")
if (checkOkToLetIn(human.Parent.Name)) then
print("Human passed test")
for i = 0,1,0.1 do
Door.Transparency = i
wait()
end
Door.CanCollide = false
hint = Instance.new("Hint", workspace)
hint.Text = hit.Parent.Name .. " has entered"
wait(1)
hint.Parent = nil
Door.CanCollide = true
wait()
for i = 1,0,-0.1 do
Door.Transparency = i
wait()
end
else human.Health= 0
hint = Instance.new("Hint", workspace)
hint.Text = hit.Parent.Name .. " has failed to enter"
end
wait(1)
hint:Destroy()
end
end
script.Parent.Touched:connect(onTouched) |
|
|
@Tame's last post
AHH, THE INEFFICIENCY.. IT BURNSS.. |
|
TameDroneJoin Date: 2010-12-09 Post Count: 1006 |
I think that vroke it cause it won't work |
|
|
@ggfunny Yours isn't that efficient either. |
|
TameDroneJoin Date: 2010-12-09 Post Count: 1006 |
How would I fix it? |
|
|
Sorry but right now I'm doing something else, so I'm not reading the full script, I could just write a new one since it would be easier for me but harder for you. |
|
|
Is it giving any output for it? |
|
TameDroneJoin Date: 2010-12-09 Post Count: 1006 |
Idk o: |
|
|
@RATE
My what is isn't efficient..? |
|
|
Okay, what is it doing / what isn't it doing? |
|
TameDroneJoin Date: 2010-12-09 Post Count: 1006 |
When I touch the door, nothing happens, it won't to the transparency, it won't show the hint, it won't let me go through it, and it won't kill me.
So yeah nothing happens, therefore nothing is working. |
|
TameDroneJoin Date: 2010-12-09 Post Count: 1006 |
Help? |
|
TameDroneJoin Date: 2010-12-09 Post Count: 1006 |
hint = Instance.new("Hint", workspace)
Workspace.group.door.master
hint.Text = hit.Parent.Name .. " has entered"
wait(1)
hint.Parent = nil
--The full script:
print("VIP Door Script loaded")
GroupId = 355206
function checkOkToLetIn(name)
if game.Players[name]:IsInGroup(GroupId) == true then return true end
return false
end
local Door = script.Parent
function onTouched(hit)
print("Door Hit")
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil ) then
print("Human touched door")
if (checkOkToLetIn(human.Parent.Name)) then
print("Human passed test")
Door.Transparency = 0.1
wait()
Door.Transparency = 0.2
wait()
Door.Transparency = 0.3
wait()
Door.Transparency = 0.4
wait()
Door.Transparency = 0.5
wait()
Door.Transparency = 0.6
wait()
Door.Transparency = 0.7
wait()
Door.Transparency = 0.8
wait()
Door.Transparency = 0.9
wait()
Door.Transparency = 1
wait()
Door.CanCollide = false
hint = Instance.new("Hint", workspace)
hint.Text = hit.Parent.Name .. " has entered"
wait(1)
hint.Parent = nil
Door.CanCollide = true
wait()
Door.Transparency = 0.9
wait()
Door.Transparency = 0.8
wait()
Door.Transparency = 0.7
wait()
Door.Transparency = 0.6
wait()
Door.Transparency = 0.5
wait()
Door.Transparency = 0.4
wait()
Door.Transparency = 0.3
wait()
Door.Transparency = 0.2
wait()
Door.Transparency = 0.1
wait()
Door.Transparency = 0
wait()
else human.Health= 0
hint = Instance.new("Hint", workspace)
hint.Text = hit.Parent.Name .. " has failed to enter"
end
end
end
end
script.Parent.Touched:connect(onTouched)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--[[It keeps on saying this:
15:44:16 - Workspace.group door.master script:3: '=' expected near 'hint'
But Idk what it means by that, no matter where I put an equal sign, it won't work!]] |
|
TameDroneJoin Date: 2010-12-09 Post Count: 1006 |
Help?!?!?!?! |
|
TameDroneJoin Date: 2010-12-09 Post Count: 1006 |
It keeps on saying this:
15:44:16 - Workspace.group door.master script:3: '=' expected near 'hint'
But Idk what it means by that, no matter where I put an equal sign, it won't work. |
|
EverestyJoin Date: 2009-10-08 Post Count: 6156 |
Your Problem Is hit.Parent.Name, 'hit' is not defined. |
|
TameDroneJoin Date: 2010-12-09 Post Count: 1006 |
I'm not the best scripter, what would I have to do to define it? |
|
EverestyJoin Date: 2009-10-08 Post Count: 6156 |
function onTouched(hit)
end
script.Parent.Touched:connect(onTouched) |
|