Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why isn't the String Value changing?

script 1:

local ship = workspace.Ship
local value = workspace.Value.Value

if value == 'intermission' then
	local new = ship:Clone()
	new.Parent = game.ServerStorage
	value = 'ready'
end 

if value == 'regening' then
	local shipclone = game.ServerStorage.Ship
	local map = shipclone
	map.Parent = workspace
	value = 'intermission'
end

script 2:

local ship = script.Parent
local value = workspace.Value.Value
local PP = script.Parent.PrimaryPart
local explosion = workspace.Explosion
local sinking = workspace["Ship Sink 1"]
local wave = workspace["Ocean wave sound effects [HD]"]
workspace["Titanic Grand Staircase Ambiance "]:Play()
wave:Play()
 
function sink()
	value = 'sinking'
	--private scripting
end
value = 'regening'

if value == 'ready' then
	wait(60)
	sink()
end

Pls help

4 comments

0

Please explain your problem a bit more!

0

Well, i have 2 scripts: the one that sinks the ship (i dont want it leaked) and this one. This one is the regeneration script. I need the value to change so that i could see when something is supposed to change, but it doesnt change. Help.

1

what kind of scripts and also for script 1 I recommend you try changing the name of Value to something else because workspace.Value doesn't exist. change the name of the stringvalue then try... Also change Value to local value = workspce.value instead of workspace.Value.Value

0

i will try that.

1 answer

✓ Accepted answer

You want to use Changed on problems like this.

Only use Changed on values like Stringvalue or intvalues

local ship = workspace.Ship
local value = workspace.Value

value.Changed:Connect(function() -- ONLY USE CHANGED FOR STRINGVALUES, OBJECTVALUES, INTVALUES AND NUMBERVALUE, CFRAMEVALUES
	if value.Value == 'intermission' then
	    local new = ship:Clone()
	    new.Parent = game.ServerStorage
	    value.Value = 'ready'
	elseif value.Value == 'regening' then
	    local shipclone = game.ServerStorage.Ship
	    local map = shipclone
	    map.Parent = workspace
	    value.Value = 'intermission'
	end 
	
end)

Script 2:

local ship = script.Parent
local value = workspace.Value.Value
local PP = script.Parent.PrimaryPart
local explosion = workspace.Explosion
local sinking = workspace["Ship Sink 1"]
local wave = workspace["Ocean wave sound effects [HD]"]
workspace["Titanic Grand Staircase Ambiance "]:Play()
wave:Play()
function sink()
    value = 'sinking'
    --private scripting
	wait(100) -- Change this to how long you think it should sink for
	value.Value = 'regening'
end




value.Changed:Connect(function()
if value.Value == 'ready' then
    wait(60)
    sink()
end
end)

If this helped, please mark this as the answer

7 comments

0

alright, to the testing!

0

Most important thing when using code from answers: TESTING!

0

no, didnt work, sorry.

0

edited

0

still didnt work

0

i have no idea.

0

also that "wait" you put in is not necessary as the regening thing is at the end of the function, and thats when the ship stops sinking.

This discussion is preserved as it was. New answers, comments, and votes are closed.