Yes, that could be. Check your script before running it, because a small error will stop it from running.
oh i removed it, ima try it now
Mousaim is basically a variable, the script recognizes it as the argument passed from the client, you can name it whatever you want, like urMOM, hahaImABadScripter or whatever, you can pass on the Position of the targetPart as an argument of the fire server. Just do :
Whatever event:FireServer(–Argument 1 is always the player, dont need to add it, MOuse.Hit.P, Target_Part.Position)
Target_Part.Position wont work if the target part IsA Model
If it’s a model use originposition ( i think? )
Or you can just set the primaryPart and use model.PrimaryPart.Position – i use this lol
oh ok i just didnt understand this quoted part, and how i get the children of the model (that is a npc) then
Alr Ill explain
character69420
To pass on information from the client to server, the arguments in the FireServer use something known as Tuples. (Arguments are basically what you add in the Parenthesis, like FIreServer(Arguments in here))
The first argument of the FireServer is Always the player, and you dont need to add it in. But you do need to specify it in the ServerScript. For Example,
Local Script:
local number = 420.69
Event:FireServer(number) -- You pass on the number
ServerScript:
Event.OnServerEvent:Connect(function(number) -- paraneters of the server script
-- if you try to print the number, it will come out as nil, because
-- AS I said, the first argument in the fire server is always the player,
--so you dont need to specify it, but you do need to add it on the server script
end)
Correct server Script will be:
Event.OnServerEvent:Connect(function(player, number) -- now the script knows that the number is the second param, you can pass multiple arguments from the client, but just remember to add player as the first parameter in the server script : D
You dont need to learn what tuples are yet, (they are 2d arrays I think)|
Hope this Helped : D
Ohhhhh now i understand it, but one last question: how do i get then the target part of the mouse
You can make a variable for it on the client, and then pass it on to the server.
local _MouseTarget = Mouse.Target
Event:FireServer(_MouseTarget)
Server:
event.OnServerEvent:Connect(function(player, currMouseTarget) -- name it whatever
while wait(0.6) do
print(currMouseTarget)
end
end)
Hope that my explanation gives you a good example of how roblox's client-server model works (basically remote eventss and functions)
Dont Focus on tuples for now, learn them when you start getting better at scripting. Here is an article that helps: What are tuples? - #9 by TheEdgyDev
Oh i understand it, butttt its still not geting the mousetarget : / srry if its annoying
Thats weird. Ill try on my own, one second
TOtally works for me.
I dont know why your script isnt workin, sorry
No problem! it is not annoying, People on the devforum dont get annoyed because of helping a beginner understand a doubt
wait, but my script its in a tool, and works when its activated is that a problem?
equip the tool and then the mouse target will be printed
oh ok
message has no 30 letters
its equiped
message has no 30000 letters
Is the targetPart being printed?
nope, wait ima try adapting your script to mine and see if it works