How would i make a toggle setting on newly created objects?

Hey there,

So i’ve made this script that when the event is fired it clones a Particle into wherever it hits and I’m trying to make a GUI when pressed on/off if off the Particles should be disabled.

Fire Script:

  hurt = true	 -- Damage
  for _, child in pairs(wep:GetChildren()) do
  	if child:IsA("Part") then	
  	child.Touched:connect(function(hit)
  		if hit.Parent:FindFirstChild("Humanoid") ~= nil and hurt == true then
  			soundsclone.Hit:Play()
  			hit.Parent:FindFirstChild("Humanoid"):TakeDamage(25)
  			hurt = false
  			Bleed:Fire(hit)

Listener Script:

Bleed.Event:Connect(function(hit)

local bloodclone = blood:Clone()

bloodclone.Parent = hit print(hit)

bloodclone.Enabled = true

wait(.35)

bloodclone:Destroy()

end)

Thanks to anyone who can guide/help me,

For your local script you need to have “FireServer()” to actually fire the event instead of just “Fire”. And your server script has to be Bleed.OnserverEvent:Connect(function() to actually connect to the signal and all your damage stuff is best done on the server script along with the cloning.

They are both BindableEvent’s no localscripts

Ah I have very little experience in BindableEvents, if I were you, I would utilise local scripts to detect the click and a script to execute the function.

Yes i do have a local script that does exactly that, You dont happen to have any clue on how id go about doing my question tho?

You did say you didn’t have any local scripts fam.

Yes but the local script isn’t posted on this thread tho

The client should be handling particle effects if you want this to be of any usefulness. Instead of firing a BindableEvent, fire a RemoteEvent telling the client it should be simulating blood particles on a part. Then, wherever you store your setting, check if the blood setting is enabled or not. If it is, then proceed to add the blood particles. If not, then don’t do anything. A simple guard clause can handle this.

Made the changes both onto local scripts, Below is the code i went with but doesn’t seem to be working?

Local script:

local onoff = game.StarterGui.DisableBlood.OnOff.Value

local toggle = script.Parent.Frame.Toggle

toggle.MouseButton1Down:Connect(function()

onoff = false print(onoff)

end)

Local Script:

Bleed.OnClientEvent:Connect(function(hit)

if onoff == true then print(onoff)

end

elseif onoff == false then

end

local bloodclone = blood:Clone()

bloodclone.Parent = hit print(hit)

bloodclone.Enabled = true

local bloodclone2 = blood2:Clone()

bloodclone2.Parent = hit print(hit)

bloodclone2.Enabled = true

wait(.35)

bloodclone:Destroy()

bloodclone2:Destroy()

end)

Keep in mind i’m super new to scripting so this might look obvious to why it doesn’t work

Changed it to put the check in a Script then fire the event depending on that but i can’t seem to change the Check value on the Client side?