Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help Me: Firing Events With A Value?

I want to protect my game from exploiters that fire events to create parts. I don't want replies saying "this won't help at all!1", because I have a system that'd work with this.

Here's my local script context:

script.Parent.Activated:Connect(function()
game:GetService("ReplicatedStorage").PartCreate:FireServer("d85jh34hdfj3dg")
end)

Here's my server side script context:

game:GetService("ReplicatedStorage").PartCreate.OnServerEvent:Connect(function(Player)
local Part = Instance.new("Part")
Part.Parent = game:GetService("Workspace").Parts
Part.Name = "ClientPart";
Part.Position = Player.Character.Torso.Position
Part.Size = Vector3.new(4, 1, 2)
Part.BrickColor = BrickColor.Random()
Part.CanCollide = true
Part.Anchored = false
end)

Now how can I have the script only fire if the password is correct?

5 comments

0

Please make it recognized as code before I help you. To'do this add ~~~~~~~~~~~~~~~~~ at the top and bottom of your code.

0

Done.

0

Is the password the variable you are sending?

0

d85jh34hdfj3dg

0

Yeah that won't help you. Exploiters can see what variables you are passing through a RemoteEvent making your efforts pointless.

1 answer

You need to add the password argument to the function you are creating on the server, so that you can check to see if it is valid.

game:GetService("ReplicatedStorage").PartCreate.OnServerEvent:Connect(function(Player, password)
	-- Check if password is correct
	if password == "d85jh34hdfj3dg" then
		local Part = Instance.new("Part")
		Part.Parent = game:GetService("Workspace").Parts
		Part.Name = "ClientPart";
		Part.Position = Player.Character.Torso.Position
		Part.Size = Vector3.new(4, 1, 2)
		Part.BrickColor = BrickColor.Random()
		Part.CanCollide = true
		Part.Anchored = false
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.