#I have a script that should emit particles once i touch a part, it doesn't .
27 messages · Page 1 of 1 (latest)
trying to understand why it doesnt work i kept changing the script
see the same script also played a sound and it always played so there ws no reason the particles wouldnt emit
i tried removing the sound completely thinking it was the problem, from the workspace from the script even copy pasting the same script without a mention of the sound and adding prints to show the status of the script
the sound still played
the prints never got printe and theres no erros
even just a simple print hellow world at the very start doesnt print??
print("hello world")
local DataStoreService = game:GetService("DataStoreService")
local GemsStore = DataStoreService:GetDataStore("GemsStore")
local sound = script.Parent.Sound
local particleemit = script.Parent.ParticleEmitter
print("success0")
function savePlayerData(player)
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local Gems = leaderstats:FindFirstChild("Gems")
if Gems then
GemsStore:SetAsync(player.UserId .. "_Gems", Gems.Value)
end
end
end
print("success1")
game.Players.PlayerAdded:Connect(function(player)
for _, Gem in pairs(game.Workspace.GemGiver:GetChildren()) do
Gem.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
print("success2")
local GemNumber = tonumber(Gem.Name)
print("success3")
if player.leaderstats.Gems.Value < GemNumber then
player.leaderstats.Gems.Value = GemNumber
if not sound.IsPlaying then
print("Success4")
sound:Play()
print("success5")
particleemit:Emit(50)
print("success6")
end
end
end
end)
end
print("success7")
end)
i tried printing at every stage of the script to see what happens
it just keeps on loping 2 3 2 3 2 3 even after i touched the part
because you have no debounce time set
so its looping since your character is moving on it
maybe u have a property in the particle emitter thats not set right
yeah i tried telling him that
pro
i tried with a default particle emitter
doent work
how do i do that
but like the looping isnt a problem, how does it not go through the sound:play() part and still play it
like the portion of the script after the constant looping works
