#Event not firing to client from server on cloned script

1 messages · Page 1 of 1 (latest)

vagrant hound
#

my script is on a tower that gets cloned when placed, the script works fine but it just wont fire an event to the script local script that is also cloned under the script where the event is fired from

lone swan
#

@vagrant hound add in some prints, to make sure check attack is getting fired, and Target exists

vagrant hound
#

i did

#

the prints get all the way to the event fire

#

i have a print on the event recieve and i get nothing

#

@lone swan

lone swan
vagrant hound
#

without any arguments i get an error

#

with just a player argument i still get nothing

#

let me change it to fireallclients and see if it makes a difference

vagrant hound
#

getting my target found print but the fire doesnt do anything

lone swan
#

alright my next question is

#

in both scripts are you referancing the same remote event

vagrant hound
#

Yes

#

yes i am

lone swan
#

Is the top script server, and the bottom client yeah?

knotty citrus
# vagrant hound

in here in the

animateTowerEvent:FireClient(player, newTower, "Attack", target)

your inputting 3 actual argument and the player is who you are sending it to.

knotty citrus
# vagrant hound

However in here.

the function on the client wants 4 arguments. and since your referencing your player in this then just use the LocalPlayer and remove the player argument in this

vagrant hound
knotty citrus
#

hes asking if the second image is a local script

#

and the first image is a server

vagrant hound
knotty citrus
#

dont remove all arguments

vagrant hound
#

image 1 is server

#

image 2 is client

#

wait sorry

#

wrong way round

#

wait no im right

#

image 1 server

#

image 2 client

vagrant hound
knotty citrus
#

Remove the "player" argument in the client script

#

and instead create a player variable

vagrant hound
#

on both?

#

theres 2

knotty citrus
#
local Players = game:GetService("Players")
local player = Players.LocalPlayer
knotty citrus
# vagrant hound

for "FireAllClients" you dont need to specify which player your sending it to

knotty citrus
vagrant hound
#

should i use FireAllClients or FireClient

knotty citrus
#

depends on the context and what your making and so on

#

im guessing your making a tower defense game?

#

or something

vagrant hound
#

Tower Defence Game, and the scripts you were helping me with are inside of one of the towers and will be inside all of them

knotty citrus
#

if you can have multiple players in the same Match then FireAllClients as its more than 1 person

vagrant hound
#

okay i use fireallclients

#

so hold on

#

at the told i added the player variable

#

should i remove the player as a argument for my checkAttack.Event

knotty citrus
vagrant hound
#

the animateTowerEvent is being sent from server

knotty citrus
#

you cant access a "Local" player on server script

vagrant hound
#

so im confused what you want me to do?

#

you want me to remove the player argument on server side?

knotty citrus
compact cedarBOT
#

studio** You are now Level 9! **studio

knotty citrus
#

whenever your reference a player

#

you can do it through the local player.

vagrant hound
#

okay okay

#

1 sec

#

i did that let me test

#

im still getting nothing on the the animateTowerEvent receive

#

heres an updated look at the scripts

knotty citrus
#

is CheckAttack actually firing. or can it just not find a target or "head" of the newtower

knotty citrus
# vagrant hound

because you should at least have "EVENT STARTED" from this one

vagrant hound
#

its finding the target on my server side

#

so idk im so confused

knotty citrus
#

not sure then if it is finding the target and supposedly firing the event without any errors and the "print" statement isnt printing then im currently not sure

vagrant hound
#

im unsure to, it must not be firing the event, thats the only explanation

knotty citrus
#

where is the animateTowerEvent located

vagrant hound
#

ReplicatedStorage - RemoteEvents

knotty citrus
#

game.ReplicatedStorage.RemoteEvents.animateTowerEvent:FireAllClients(nil, "Attack", nil)

#

run that in the console

#

this bar thing

vagrant hound
#

yea i know

#

it says its not a valid member of Folder

knotty citrus
#

is your event called what i wrote

#

is it spelt

vagrant hound
#

no

knotty citrus
#

animateTowerEvent

knotty citrus
vagrant hound
#

the variable is animateTowerEvent and the name is "AnimateTower"

knotty citrus
#

game.ReplicatedStorage.RemoteEvents.AnimateTower:FireAllClients(nil, "Attack", nil)

vagrant hound
#

"FireAllClients can only be called from the server"

knotty citrus
#

make sure to be running/playing first and then switch over to server side

#

the one of the right here

#

click that

vagrant hound
#

i know

#

i ran it and got nothing

knotty citrus
#

not sure then. Just delete and re-add the remote or something atp then if you didnt even get a print statement out of that line of code ¯_(ツ)_/¯

vagrant hound
#

alright let me try

#

just to double check, a remote event crosses the server and client boundary?

knotty citrus
#

a remote event can be fired from the

Client -> Server

and

Server -> Client