Possible String Concatenation Errors? Text Boxes, Particle Emitters, and IDs

I’ve been attempting to change a particle emitter’s texture ID by firing the server with the text from a text box. However, I haven’t been able to get anywhere with it. I’ve tried do all sorts of things to get the particles to change or appear but that never happens and I receive no errors from the console whatsoever.

I’ve used print statements to print the variable’s value before it’s fired (at the client), after it’s fired (at the server), and retrieved using asyncs. The value is always a string, and always the correct ID.

Here are the two main scripts controlling the mechanism. This one retrieves the ID from asyncs when a player joins:

local particleIDStore = game:GetService("DataStoreService"):GetDataStore("ParticleIDStore")
local RunService = game:GetService("RunService")
local badgeService = game:GetService("BadgeService")
local badgeID = REDACTED

game.Players.PlayerAdded:Connect(function(plr)
	RunService.Heartbeat:Wait()
	badgeService:AwardBadge(plr.userId, badgeID)
	
	plr.CharacterAdded:Connect(function(char)
		if plr:GetRankInGroup(REDACTED) >= 1 then
			local Part = script.ParticleEffect:Clone()
			local torso = game.Workspace:WaitForChild(plr.Name).UpperTorso
			Part.Parent = torso
			Part.Position = torso.Position
			Part.Weld.Part1 = torso
		
			local success, textureID = pcall(function()
				return particleIDStore:GetAsync(plr.UserId)
			end)
			
			if success then
				if textureID == nil then --If no textures are found in the data store for that player?
					plr.Character.UpperTorso.ParticleEffect.ParticleEmitter.Texture = "rbxasset://textures/particles/sparkles_main.dds"
				else
					plr.Character.UpperTorso.ParticleEffect.ParticleEmitter.Texture = "http://www.roblox.com/asset/?id=" .. textureID
					--plr.Character.UpperTorso.ParticleEffect.ParticleEmitter.Texture = "rbxasset://" .. textureID
				end
			else -- If the call wasn't a success?
				plr.Character.UpperTorso.ParticleEffect.ParticleEmitter.Texture = "rbxasset://textures/particles/sparkles_main.dds"
			end
		end
	end)
end)

And this one applies the ID from the textbox in the game and saves it to the asyncs:

local ChangeParticles = game.ReplicatedStorage:WaitForChild("ChangeParticles")
local particleIDStore = game:GetService("DataStoreService"):GetDataStore("ParticleIDStore")

function changeTextureID(player, ID)
	if player.Character.UpperTorso:FindFirstChild("ParticleEffect") == nil then
		player:Kick("Prove to me you didn't just fire that event by exploiting.")
	else
		player.Character.UpperTorso.ParticleEffect.ParticleEmitter.Texture = "http://www.roblox.com/asset/?id=" .. ID
		--player.Character.UpperTorso.ParticleEffect.ParticleEmitter.Texture = "rbxasset://" .. ID
		
		pcall(function()
			particleIDStore:SetAsync(player.UserId, ID)
		end)
	end
end

ChangeParticles.OnServerEvent:Connect(changeTextureID)

Any help in determining why I’m unable to get it to work let alone output anything in the console would be appreciated.

1 Like