I suggest you post some error messages instead of just saying ‘not working’ over and over, how can anyone help you?
In error codes shows me that there is no default in BloomCharmixPin. (I changed the name of the part)
I had to use :waitForChild on default part. Thanks for help!!!
Always remember to update the path with the part’s new name if you change it
What’s the new name of the default part?
Its BloomCharmixPin.default I had to use :WaitForChild() on default.
In the meantime I was working on rewriting the script, so you can use this version if you prefer:
local Debris = game:GetService("Debris")
local Workspace = game:GetService("Workspace")
local gui = script.Parent
local bloomCharmixPin = Workspace:WaitForChild("BloomCharmixPin")
local proximity1 = bloomCharmixPin:WaitForChild("default"):WaitForChild("ProximityPrompt")
local stellaCharmixPin = Workspace:WaitForChild("StellaCharmixPin")
local proximity2 = stellaCharmixPin:WaitForChild("default"):WaitForChild("ProximityPrompt")
local floraCharmixPin = Workspace:WaitForChild("FloraCharmixPin")
local proximity3 = floraCharmixPin:WaitForChild("default"):WaitForChild("ProximityPrompt")
proximity1.Triggered:Connect(function()
local value = tonumber(gui.Text)
gui.Text = if value then value + 6 else warn("Unable to convert text to number")
Debris:AddItem(bloomCharmixPin, 0)
end)
proximity2.Triggered:Connect(function()
local value = tonumber(gui.Text)
gui.Text = if value then value + 1 else warn("Unable to convert text to number")
Debris:AddItem(stellaCharmixPin, 0)
end)
proximity3.Triggered:Connect(function()
local value = tonumber(gui.Text)
gui.Text = if value then value + 1 else warn("Unable to convert text to number")
Debris:AddItem(floraCharmixPin, 0)
end)
Do I need to use tonumber
if it works when i use += 1
?
tonumber
is there for compatibility with strict type-checking, so you can do gui.Text += 1
if you don’t use strict and are sure that the Gui’s text can always be converted to a number
New Script:
local bloomCharmixPin = game.Workspace:WaitForChild("BloomCharmixPin")
local floraCharmixPin = game.Workspace:WaitForChild("FloraCharmixPin")
local stellaCharmixPin = game.Workspace:WaitForChild("StellaCharmixPin")
local proxBloom = bloomCharmixPin:WaitForChild("default"):WaitForChild("ProximityPrompt")
local proxStella = stellaCharmixPin:WaitForChild("default"):WaitForChild("ProximityPrompt")
local proxFlora = floraCharmixPin:WaitForChild("default"):WaitForChild("ProximityPrompt")
local gui = script.Parent
proxBloom.Triggered:Connect(function()
gui.Text += 6
proxBloom.Parent.Parent:Destroy()
end)
proxStella.Triggered:Connect(function()
gui.Text += 1
proxStella.Parent.Parent:Destroy()
end)
proxFlora.Triggered:Connect(function()
gui.Text += 1
proxFlora.Parent.Parent:Destroy()
end)
gui:GetPropertyChangedSignal("Text"):Connect(function()
if gui.Text == 6 then
game.ReplicatedStorage.StellaMFCharmix:FireServer()
game:GetService("StarterGui"):GetCore("ResetButtonCallback", false)
end
end)
The warning explains quite well what happened: An Instance named “default” is taking longer than 5 seconds to load, and usually this means that it either doesn’t exist or is named something else
Does an Instance named “default” exist as a child of StellaCharmixPin?
yes, but it’s not laoding into the game
Unless you use WaitForChild
’s second argument that adds a timeout (and you’re not), WaitForChild
will wait for the Instance to load indefinitely, so as I explained, the issue is either an Instance named default
doesn’t exist inside of StellaCharmixPin
or the Instance is accidentally named something else instead of default
Remember that names are case-sensitive, so Default
does not equal to default
Could it doesn’t load by rendering map?
If you’re using streaming enabled, then I recommend using a separate script for each ProximityPrompt in-order to keep things simple, else you’ll have to worry about Instances streaming in and out
Because when I go to another one next disappears and that appears.
Now I turn it to disable right now, I will test it. (Now it’s working)
and I have question with 2nd part of the script. How do you recomend to check if the text number is 6? of using retun maybe?
I recommend learning about CollectionService and tags if you ever want to turn streaming enabled back on, since it will help you detect when Instances load
@TheCookieDragonPlays To check if the text is equal to 6, you’ll need to use the tonumber
function to get an accurate result, as an example: tonumber(gui.Text) == 6
So it would be if tonumber(gui.Text) == 6 then
? I used GetPropertyChangeSignal but not working