JonibusJoin Date: 2010-01-30 Post Count: 8985 |
I am making a build/fight game. I need a script that, after a certain amount of time, removes the building tools in your StarterPack, and puts in fighting tools. Any suggestions on how I could do that? |
|
ServerHaxJoin Date: 2012-02-29 Post Count: 16 |
I have an idea... But this is what I would put in the tool in a different script.
while true do
wait(0.5)
if game.Workspace.Build.Value == false then
script.Parent:remove()
elseif game.Workspace.Build.Value == true then
print("Not time yet")
end
end
-- not sure if this is needed... end |
|
JonibusJoin Date: 2010-01-30 Post Count: 8985 |
Nope, didn't work. Even tested your idea in 4 different other ways. Perhaps putting the tools into Lighting, then making the script take the current tools away, then put the new tools in? Also it would help if the script then ended with a wait. Like,
Complicated script that I am yet to come up with
that will change the tools:
wait(400)
Repeat command to make the script continue forever
that way as the rounds end, the script continues.
Ideas? If it's a bad idea could someone help me out a little more? |
|
|
Actually jonman, your on the right path. You have to make it wait a certain amount of time, then remove the tools in backpack, and take new ones out of lighting. I might be able to find a script like this for you one sec.
+-Fishy |
|
JonibusJoin Date: 2010-01-30 Post Count: 8985 |
Thanks! If you find me one, I will credit you for the help :D
~~jonman11 |
|
|
Ok. There was actually a post about the same thing earlier...but I can't seem to find it. I'll keep looking though.
+-Fishy |
|
|
This is one fairly close to what your looking for. This script that says "when a brick is touched, remove the tools in backpack, and insert the ones from lighting". You will have to edit it to a wait() instead of onTouch. I'll try to help if you want. Here it is:
script.Parent.Touched:connect(function(hit)
ply = game.Players:GetPlayerFromCharacter(hit.Parent)
if ply then
if hit.Parent:FindFirstChild("ToolGiven") == nil then
ply.Backpack:ClearAllChildren()
tag = Instance.new("StringValue",hit.Parent)
tag.Name = "ToolGiven"
for i,v in pairs(game.Lighting.Tools:GetChildren()) do
tool = v:clone()
tool.Parent = ply.Backpack
end
end
end
end)
+-Fishy |
|
|
Something along the lines of this. Not saying that this is right, but closer.
game.Players.CharecterAdded:GetPlayerFromCharacter(plyr()
plyr = game.Players:GetPlayerFromCharacter(CharacterAdded()
if plyr then
if CharacterAdded:FindFirstChild("ToolGiven") == nil then
plyr.Backpack:ClearAllChildren()
tag = Instance.new("StringValue",CharacterAdded)
tag.Name = "ToolGiven"
for i,v in pairs(game.Lighting.Tools:GetChildren()) do
tool = v:clone()
tool.Parent = plyr.Backpack
end
end
end
end)
+-Fishy |
|
JonibusJoin Date: 2010-01-30 Post Count: 8985 |
Thanks! I will try it and tweak it to try and get it to work.
~~jonman11 |
|
JonibusJoin Date: 2010-01-30 Post Count: 8985 |
I am unable to tweak it. I have tried 13 different attempts now. Anyone got any other suggestions, or how to fix it? I need help :O |
|
|
Well, instead of going off my wrong second version, go off the onTouch version. I know that one works because the thread I got this from, the person that wanted it said it worked...sooo...I guess just go off of that.
+-Fishy |
|
JonibusJoin Date: 2010-01-30 Post Count: 8985 |
Ok, thanks. I might change it to wait, perhaps. |
|