Part won't destroy on detection

Uhm ill let the other people fix it for you but, you must NOT use local scripts, they can easily be altered/hacked by exploiters, an exploiter can give himself inf cash if u will remove them locally, it will work perfectly fine so try avoiding that, if i came tomorrow and this isn’t solved yet, ill solve it myself.

I was trying to do client scripts for that reason, but then i needed to add checks for where local player was apart of the path so then i had to make it a local script

You can do whatever you want by local scripts but the money checking and changing MUST be done thought the server, use RemoteEvents to communicate between client and server

idk how to do, im on week 1 scripting

Oh alright,
Add a remote event in replicatedStorage or wherver you want to
after doing whatever you want in the local script use RemoteEvent:FireServer() and in a server script use RemoteEvent.OnServerEvent:Connect(function() and make it return true if he has enough money, i dont think i explained very well so ill make a place tomorrow and give it to you so you understand more…

This is a bit complicated but you will get used to it pretty quickly…

Alright thank you, I’m trying to expand my knowledge in development since I’m currently just a builder

Im on phone rn thats why i cant get you enough info you can add me in discord and ill help you there, i can teach you everything you want…
Msix29#7740

I sent the friend request, im sins

1 Like

have you tried putting the folder in lighting, sometimes this is the simple fix

(of course change the location in the script)

I tried that yes, didn’t work either.

when you bet 10, you spawn only a single ball? or multiple balls

Parent returns an instance, not a string
h.Parent.Name==“LowRisk”

Bet 10 on 1 ball, may add other things in the futures but thats just the safe for now

finished it, there it is, you only need to check out all minor changes i made, if you need any help, contact me in devforum via msg
voids gamble game.rbxl (61.1 KB)

using local script is the same as Server script, but some things cannot be detect by the server, and others functions you will need to specify the player that ''Triggered this event or action" like this:


[ Server- Side Script]

game.Players.PlayerAdded:Connect(function(player) 
--now we detect when a new player joined in our game, and each player will have different functions
--whatever, with a good understanding you will notice that the player can trigger events that will affect
-- the whole server... (this is where remote functions and Remove Events are needed...

end)

I have 1 question, how can I make it detect which category it feel in, i don’t see the script for it and I need to make the reward function where you get the winnings

well i don’t too much time to explain but,

this is easy, to detect which Risk Touched, i’ll help you on this one,

winning function is like cash function, i don’t quite understand how you plan to make your Winning system

--// Spawn Ball Section

local cash = game.Players.LocalPlayer.leaderstats.Cash.Value

local alreadyBet = false

local RS = game:GetService("ReplicatedStorage")

local BallList = RS:WaitForChild("PlinkoBalls")

local Balls = BallList:GetChildren()
local items = BallList:GetChildren()
local randomBall = items[math.random(1, #items)]
local T = nil
local ballCopy = nil
function SpawnBall()
	
	
	
	if bet == 0 then
	else

		if game.Players.LocalPlayer.leaderstats.Cash.Value >= bet then
			game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value - bet
			
			
				
				print("Plink Ball Purchased")
			

			


			print("Plink Ball Purchased")
			ballCopy = randomBall:Clone()
			for i = #items, #Balls do
				
				ballCopy.Parent = game.Workspace.Plinko.Balls
				ballCopy.Name = "PlinkoBall"
				ballCopy.Value.Value = bet
			
			end
			
			if alreadyBet == true then
				print(ballCopy)
				return
			end
			
			alreadyBet = true
			
				for I,Risks in pairs(game.ReplicatedStorage.HighRisk:GetChildren()) do
					--will clone all parts inside this folder.... so it will print something in the Output, and points may be allocated ( currently will not work because you must create your own system of points )
				local T = Risks:Clone()
				T.Parent = game.Workspace.HighRisk
					--T.Parent = game.Workspace.HighRisk
				T.Touched:Connect(function(Hit)
					if T.Name == "0.5x" then
						print("0.5x Outcome")
						local outcome = bet * 0.5
						game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + outcome
					end
					if T.Name == "1.0x" then
						print("1.0x Outcome")
						local outcome = bet * 1.0
						game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + outcome
					end
					if T.Name == "1.3x" then
						print("1.3x Outcome")
						local outcome = bet * 1.3
						game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + outcome
					end
					if T.Name == "1.5x" then
						print("1.5x Outcome")
						local outcome = bet * 1.5
						game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + outcome
					end
					if T.Name == "2.0x" then
						print("2.0x Outcome")
						local outcome = bet * 2.0
						game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + outcome
					end
					Hit:Destroy() -- Destroy the cloned ball
			
					
				end)
					
			
			end
		end
	end
end

This is what I tried to add which explains my idea for it

I think it worked, idk again im new to this :woman_shrugging:

The issue is that ur cloning the ball in a localscript and checking if the ball touched a part in a “normal” script. The ball only exosts on the client therfore the server doesnt know it exists