So i making this were you can jump on platforms and i wanted to make finish part which should fire event called win in replicated storage once touched but once i touch part i get this error Argument 1 missing or nil and the remote event dosent fire can somone help me.
1 | script.Parent.Touched:Connect( function (hit) |
2 |
3 | if script.Parent.BrickColor.Name = = ( "New Yeller" ) then -- checks what color is part |
4 | game.ReplicatedStorage.Win:FireClient() -- should fire event |
5 | Blur.Size = 20 |
6 | end |
7 |
8 | end ) |
Adding on to@iiMegabyeGaming, You need the player as a first argument for :FireClient to work.
Here's a script.
1 | script.Parent.Touched:Connect( function (hit) |
2 | local character = hit.Parent |
3 | local player = game.Players:GetPlayerFromCharacter(character) |
4 | if script.Parent.BrickColor.Name = = ( "New Yeller" ) then -- checks what color is part |
5 | game.ReplicatedStorage.Win:FireClient(player) -- should fire event |
6 | Blur.Size = 20 |
7 | end |
8 |
9 | end ) |
More information here: https://developer.roblox.com/en-us/api-reference/function/Players/GetPlayerFromCharacter
You need the player as a first argument for :FireClient to work. Try using :GetPlayerFromCharacter.
insert a BlurEffect inside of lighting then name it Blur. Then change the size to 20 and turn the enabled to false then add a script inside of the part you want to be touched to enable the blur then do this
1 | local Blur = game.Lighting.Blur |
2 | script.Parent.Touched:Connect( function (hit) |
3 |
4 | if script.Parent.Transparency = = 0 then |
5 | game.ReplicatedStorage.Win:FireClient() -- should fire event |
6 | Blur.Enabled = true -- enabled the blur |
7 | print ( "The Screen Is Now Blurry" ) |
8 | end |
9 | end ) |
I don't know if this works but you can try it.