✓ Accepted answer
Variables connected to properties don't change when their corresponding property changes. Use this to help.
reloadtime.Changed:Connect(function()
ReloadTime = reloadtime.Value
ReloadAnimationSpeed = reloadtime.Value + 0.2
end)
EDIT: Still won't change? Weird, try this
local UpdateCoroutine = coroutine.create(function()
while true do
ReloadTime = reloadtime.Value
ReloadAnimationSpeed = reloadtime.Value + 0.2
wait()
end
end)
coroutine.resume(UpdateCoroutine)
EDIT EDIT: Still doesn't work??? nani?
here goes
local reloadtime = script.Parent.WeaponStats.ReloadTime
local UpdateCoroutine = coroutine.create(function()
while true do
ReloadTime = script.Parent.WeaponStats.ReloadTime.Value
ReloadAnimationSpeed = script.Parent.WeaponStats.ReloadTime.Value + 0.2
wait()
end
end
coroutine.resume(UpdateCoroutine)
if this still doesn't work, it's not at the start of the script
if it still doesn't work at the start of the script, you misspelled something
if you copied it directly from the view source thingy that always is included with the lua thingy and it still doesn't work, then
while true do
spawn(function()
while true do
spawn(function()
spawn(function()
while true do
print("NANI?")
end
while true do
print("NANI?")
end
while true do
spawn(function()
while true do
print("NANI?")
end
end
while true do
print("NANI?")
end
end
end
end
while true do
spawn(function()
spawn(function()
while true do
print("NANI?")
end
while true do
print("NANI?")
end
while true do
spawn(function()
while true do
print("NANI?")
end
end
while true do
print("NANI?")
end
end
end
end
IT DIDN'T WORK?????
while true do
local corout = coroutine.create(function()
while true do
local corou = coroutine.create(function()
while true do
local coro = coroutine.create(function()
while true do
local cor = coroutine.create(function()
while true do
local co = coroutine.create(function()
print("NANI?")
end)
coroutine.resume(co)
print("NANI?")
end
end)
coroutine.resume(cor)
print("NANI?")
end
end)
coroutine.resume(coro)
print("NANI?")
end
end)
coroutine.resume(corou)
print("NANI?")
end
end)
coroutine.resume(corout)
print("NANI?")
end
1 comment
The issue is that you need to re-define the reloadtime variable, or it'll keep using the old one. Like sweetkid suggested, make a function that detects when the variable has been changed, then redefine it via the function.