#need help with this pickup script im making

1 messages · Page 1 of 1 (latest)

muted gorge
#

so basically i scripted everything important, but i need to add extra features like a remoteevent for the network owner and a fling function, but the thing is idk how to do that in a server script... ```lua
userInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end

if input.KeyCode == Enum.KeyCode.X then
    rotationAxis = "X"
elseif input.KeyCode == Enum.KeyCode.Y then
    rotationAxis = "Y"
elseif input.KeyCode == Enum.KeyCode.Z then
    rotationAxis = "Z"
elseif input.KeyCode == Enum.KeyCode.R and target then
    rotateObject(rotationAxis, rotationAngle)
elseif input.KeyCode == Enum.KeyCode.T and target then
    ure:FireServer(target.Name)
end

end)```

#

3rd to last line of code

#

how do i like

#
game.ReplicatedStorage.UnreliableRemoteEvent.OnServerEvent:Connect(function(player, target)
    print(target)
end)```
#

yk

#

i wont show the entire code so

muted gorge
#

please help me

worldly kernel
#

if you could explain more of what you mean by pickup script then i could help

#

i dont really understand what you are asking

muted gorge
#
Roblox

Check out psychic sandbox. It’s one of the millions of unique, user-generated 3D experiences created on Roblox. Not a friendly game, pvp and griefing is apart of the game.
psychic sandbox is a game about destroying the city with your psychic powers!

holding down the throw button increases the power until it reaches red.

developed by Khongumu
F...

#

kinda like this

#

where the player grabs theobject and it follows he mouse

#

the*

muted gorge
#

im adding a feature where teh player clicks "T" it will fling the object that they control

#

but i cant witout remote events

worldly kernel
#

so if you already have the code to do the physics

#

use the userinputservice to figure out when the player presses the "T" key, and if they are currently holding a part then fire a remote event and fling the part on the server

#

and remove the network ownership

#

i believe that will work

muted gorge
#

in the server script

worldly kernel
#

just send the part thats being flung over in the remote event

#

do it like this

FlingEvent:FireServer(part)

#

and on the server

--code here
end)```
muted gorge
#

i tried doing that then i tried printing the part and it wouldnt print

worldly kernel
#

because you are printing an instance

#

it will just print the name of the part

#

unless you are creating the part on the client

#

then it doesnt exist on the server and will print nil

muted gorge
#

ohhhhhh

#

there

#

i connected the wrong remote event for the

#

serverscript