|
You touch the button and the model 'Pickup' is supposed to regenerate if you own the tycoon it is a part of, however, this does not work at all.
button = script.Parent
regen = button.Parent.Regen
tycoon = script.Parent.Parent.Parent
local debounce = false
script.Parent.Head.Touched:connect(function(h)
local player = game.Players:GetPlayerFromCharacter(h.Parent)
if not (player) then return end
if (active) then return end
debounce = true
if (tycoon.Owner.Value ~= player) then
msg("This is not your " .. tycoon.Parent.NameOfTycoon.Value .. "!","Message",3,player)
debounce = false
return
end
if h ~= nil and debounce == false then
debounce = true
button.BrickColor = BrickColor.Black()
regen.Value = 1
wait()
regen.Value = 0
wait(5)
button.BrickColor = BrickColor.new(104)
debounce = false
end
end
button.Touched:connect(onTouch) |
|
|
|
|
|
this isn't a regen script
it finds the player then if he isnt owner of the tycoon it gives him a message
then it sets the value of "regen"
where is the regen part |
|
|
This activates the regen script. The regen script works fine, this is where the problem lies, it's not activating regen script. |
|
|
|
intvalue.
when it's 1 the model regens |
|
|
well then maybe its the part of the regen script that regens when the value is 1 |
|
|
local regen = ______
while true do
if regen.Value =~ 0 then
BLAH BLAH BLAH
wait()
end |
|
|
To regen a model you have to create a backup copy of it using :copy() to have a backup before it was moved somewhere else. Then, once you're ready for it, just give the copy a parent, then make a new copy. For example:
c = regen:copy()
wait(5)
c.Parent = game.Workspace
c = c:copy()
Something like that. |
|
|
^ he already said when regen value is 1 the regen activates |
|
|
No, I'm quite sure the rest of the script is quite fine as it works perfectly before I added in the tycoon owner part, that seems to break it but I'm not sure why. |
|
|
|
|
|
|
Change regen to a bool value. Change the value to true when you want to regenerating and have the regeneration script do w/e then change the value to false, not the owner script.
-- regen script
regen = script.Regen
regen.Changed:connect(function()
if not regen.Value then return end
--do stuff
regen.Value = false
end) |
|
|
Well, as I said, the script works fine without the tycoonowner part, are you sure this will fix the problem? |
|
|
|
|
|
|
|