#Run things from one script in another
24 messages · Page 1 of 1 (latest)
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?
No, remote events allow you to pass variables through one script to another, so once you pass it through the remote event, its always there in that script in the main .OnServerEvent function
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
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)
It is
Theres no other way.
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
remeber the first argument must ALWAYS be player, if you are firing from ClientSide to ServerSide
bullet then it hits that enemy passes on new speed value to that enemy
and neither of these should run on client
the 2nd can be any name for that
Why dont u just change the speed of the enemy FROM the script with the speed variable
oh yea
:/
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++
** You are now Level 1! **
but no that wont work I still need info FROM the bullet or turret cause effect will vary depending on turret level