I need help with my script

So basically i was working on a tool that stuns players. Most of the script is working with not problem but i still could not figure out how to blur player’s vision when touched the tool.

Well i tried putting it in local script but that would limit other things so i added one server script and remote event. Didn’t work out either. So i went looking on devforum and developer hub and i didn’t find the solution.

So i gave up and posted this topic…

I don’t want to sound like i want the entire scripts, because i completely deleted the code.
So i just want a help how would i make it working.

I am not good at english so you may not understand what i want to achieve

Hello, not sure if I understood.
You basically want to make the player’s screen to be blury for a moment when they take the tool?

When other player touches the tool it will stun the player and blur his vision (for example player that is holding the tool will smack him and stun him lol)

that would be the best solution


local blurevent = -- define blur event

-- when you need to
blurevent:FireServer(player, true)

local script

local blurevent = -- define blur event
local blur = -- define blur

  blur.Enabled = enabled
1 Like

@Ligij That’s the starting of the solution.
You should fire the RemoteEvent in the script, when a Touch event is fired (you should make sure that the tool has touched a player that has a humnaoid in it).
Let me know if you need help with that^

1 Like

Server script can only fire one specified cliend or all clients, how would i define player who touched the part, it would not work if player was not included

first i have to get player from touch event
but how

	if hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit)
		blurevent:FireServer(player, true)

Change the beginning of the script (“game.Workspace.PartTest”) to your part.

1 Like

Here is the outline of how I would do it. It is quite janky but it will work
(This will not work if you just past it. you have to write the code yourself, but I gave you everything you needed to put together the script)

--Local Script
get tweenservice
get local player
get mouse
get lighting.blur
get remote event
define debounce

mouse click event
    if not debounce
        set debounce to true
        fire server your mouse.Target
        wait 1 second
        set debounce to false

remote event on client event
    play tween for blur that sets size to 24
    wait however long you want
    play tween for blur that sets size to 0

--server script
get remote event
define debounce (table)

remote event on server event (params player, mouse target)
    define targetplayer = game.Players:GetPlayerFromCharacter(target:FindFirstAncestorWhichIsA(model))
    if not debounce[player] and targetplayer then
        debounce[player] = true
        stun the targetplayer using ragdoll idk
        remote event:FireClient(targetplayer)
        wait(.9) -- gotta be a bit less just in case of overlap
        debounce[player] = false
1 Like

thanks @Pure_Bacn and @GTAVandmore i made my script working! Thanks for help!

1 Like