#Run things from one script in another

24 messages · Page 1 of 1 (latest)

candid panther
#

Remote Events or Remote Functions

delicate seal
#

So for my td game particular case, bullet which is supposed to have slow effect hits enemy I will need to use these every time to change values in that enemy script?

torn sigil
delicate seal
#

well then thats not what I need no?

#

I dont need anything to have long term effect just change a bool or call function once thats it

torn sigil
#

So lets say you have a variable called "Speed" and you are trying to pass the Speed from a local script to a server, we do the following :

-- clientside
local speed = 50
[REPLACE_WITH_YOUR_REMOTE_EVENT]:Fireserver(speed)

-- serverside

[REPLACE_WITH_YOUR_REMOTE_EVENT].OnServerEvent:connect(function(player, speed)
-- now you can use the Speed here
end)
torn sigil
delicate seal
#

actually this might be fine

#

but I run these server to server

#

im REALLY new to lua so I dont know how to structure it but from c#

#

I will put hit code on bullet

torn sigil
delicate seal
#

bullet then it hits that enemy passes on new speed value to that enemy

#

and neither of these should run on client

torn sigil
#

the 2nd can be any name for that

torn sigil
delicate seal
#

oh yea

torn sigil
delicate seal
#

I listen to OnTouched event and get bullet name or any other identifier to decide what happens

#

yeah

#

I mean thats other way around how I would usually do stuff in c# or c++

charred lakeBOT
#

studio** You are now Level 1! **studio

delicate seal
#

but no that wont work I still need info FROM the bullet or turret cause effect will vary depending on turret level