|
-- i love this script, hopefully the rest of uk does too
script.Parent.MouseButton1Click:connect(function(mouse) -- mouse might be the player, idk
if script.Parent.Parent.Parent.Parent:findFirstChild("Humanoid") then
local plr = game.Players:findFirstChild(script.Parent.Parent.Parent.Parent.Name)
if plr:IsInGroup(1190944) and plr:GetRoleInGroup(1190944) >= 130 then -- HM Government+
wait(1)
print(" " ..plr.Name.. " is lowering the roadblock.")
game.Workspace.RoadBlock.One.One.Transparency = 0.5
game.Workspace.RoadBlock.One.Two.Transparency = 0.5
game.Workspace.RoadBlock.One.One.CanCollide = false
game.Workspace.RoadBlock.One.Two.CanCollide = false
print("Stage one in lowering the roadblock is complete.")
wait(1)
game.Workspace.RoadBlock.Two.One.Transparency = 0.5
game.Workspace.RoadBlock.Two.Two.Transparency = 0.5
game.Workspace.RoadBlock.Two.One.CanCollide = false
game.Workspace.RoadBlock.Two.Two.CanCollide = false
print("Stage two in lowering the roadblock is complete.")
wait(1)
game.Workspace.RoadBlock.Three.One.Transparency = 0.5
game.Workspace.RoadBlock.Three.Two.Transparency = 0.5
game.Workspace.RoadBlock.Three.One.CanCollide = false
game.Workspace.RoadBlock.Three.Two.CanCollide = false
print("Stage three in lowering the roadblock is complete.")
wait(1)
script.Parent.Parent.TextLabel.Text = "ROAD BLOCK STATUS: Offline"
print("The roadblock is now offline.")
end
end
end)
I meet the requirements to press the button (to make it do something) but when I click either of the buttons, it does nothing. I've checked the server console and there isn't any errors. There isn't any errors on the script itself either. How do I fix this issue? |
|
|
|
LightlimnJoin Date: 2010-05-09 Post Count: 4079 |
The player is not in the group, you've got the wrong group ID, wrong rank number, idk
also use "workspace" instead of "game.Workspace" |
|
|
The ID's are correct and changing it to just Workspace won't really make a difference other than removing the word 'game.' I just noticed it should be GetRankInGroup() though, not GetRoleInGroup() so I'll just bump this thread if that doesn't fix it. |
|
LightlimnJoin Date: 2010-05-09 Post Count: 4079 |
no, you should use workspace instead of game.Workspace because it's faster to type and faster for the script |
|
|
Alright, switched it to that but its still the exact same results as before. Here's the updated version.
-- i love this script, hopefully the rest of uk does too
script.Parent.MouseButton1Click:connect(function(mouse) -- mouse might be the player, idk
if script.Parent.Parent.Parent.Parent:findFirstChild("Humanoid") then
local plr = game.Players:findFirstChild(script.Parent.Parent.Parent.Parent.Name)
if plr:IsInGroup(1190944) and plr:GetRankInGroup(1190944) >= 130 then -- HM Government+
wait(1)
print(" " ..plr.Name.. " is lowering the roadblock.")
workspace.RoadBlock.One.One.Transparency = 0.5
workspace.RoadBlock.One.Two.Transparency = 0.5
workspace.RoadBlock.One.One.CanCollide = false
workspace.RoadBlock.One.Two.CanCollide = false
print("Stage one in lowering the roadblock is complete.")
wait(1)
workspace.RoadBlock.Two.One.Transparency = 0.5
workspace.RoadBlock.Two.Two.Transparency = 0.5
workspace.RoadBlock.Two.One.CanCollide = false
workspace.RoadBlock.Two.Two.CanCollide = false
print("Stage two in lowering the roadblock is complete.")
wait(1)
workspace.RoadBlock.Three.One.Transparency = 0.5
workspace.RoadBlock.Three.Two.Transparency = 0.5
workspace.RoadBlock.Three.One.CanCollide = false
workspace.RoadBlock.Three.Two.CanCollide = false
print("Stage three in lowering the roadblock is complete.")
wait(1)
script.Parent.Parent.TextLabel.Text = "ROAD BLOCK STATUS: Offline"
print("The roadblock is now offline.")
else
script.Parent.Parent.TextLabel.Text = "ERROR: You are not authorized to perform this action"
wait(5)
script.Parent.Parent.TextLabel.Text = "ROAD BLOCK STATUS: Offline"
end
end
end)
|
|
iMoonManJoin Date: 2008-11-11 Post Count: 205 |
If it's not working, post the error the script gives you when you try to run it, then let us debate the problem. |
|
|
@torr,
That's the problem. There isn't any errors yet it does nothing. |
|
|
AmnesiloxJoin Date: 2012-09-21 Post Count: 3540 |
your script is being a brat and not telling you whats wrong, maybe water board it. |
|
chimmihcJoin Date: 2014-09-01 Post Count: 17143 |
As for the workspace/game.Workspace issue I will now explain how it works.
The reason you can do game when its name is really Game and the reason you can do workspace when its name is really Workspace is something like this.
Lua 5.1 doesn't support _ENV yet but I will use it to explain the environment.
So every keyword(math,string,function, etc etc) is stored in _ENV, which is a global table holding the environment.
local Game = {
Workspace = {BasePlate = "BasePlate"},
Players ] {},
Lighting = {},
etc = {},
}
print(game.Workspace.BasePlate) -- would error since there is nothing named game.
But if you did this: _ENV.game = Game
That would work.
_ENV.workspace = Game.Workspace
And with the way Lua works using workspace over game.Workspace is not faster.
I script -~ chimmihc |
|
|
|
|
Does it print everything you tell it to print? If it doesn't then that could probably narrow it down a bit |
|
|
No, it doesn't print anything. |
|
|