Fixed it but now the script doesnt work and theres no error
You can’t :ApplyImpulse a part owned by a player (The character in this case,) from the server. I’ve tried it before.
What you can do is
game.ReplicatedStorage.RemoteEvents.OnApplyImpulse:FireClient(player, part, impulseVector)
Plus you need to set the humanoid state to Freefall before :ApplyImpulse() bcs humanoid behavior is wierd
So I have to use a localscript?
Yes, use local script to apply impulse parts owned by a client from server
i cahgned the script to a localscript and it still didnt work
Show me your code, let me test
V ah yes reply below
Make sure your local script is inside a player’s character
Or
Inside StarterPlayerScripts
Or
Inside ScreenGui
Local scripts must be inside a local being. Try placing it inside of StarterCharacterScripts and making it detect when the humanoid touches the part.
local AdditionalForce = 2500
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("HumanoidRootPart") and db == false then
db = true
hit.Parent:FindFirstChild("HumanoidRootPart"):ApplyImpulse(Vector3.new(0, hit.Parent:FindFirstChild("HumanoidRootPart").AssemblyMass * AdditionalForce, 0))
wait(0.5)
db = false
end
end)
it works! but the question is, is it only for client side since its a localscript
Okay. Ive said this before, local scripts must be inside a LOCAL BEING. Try placing it in StarterCharacterScripts and use humanoid to detect when you touch the bounce part.
Use remote events if you wish to make it server sidded. Just run a remote when they touch it.
Yes, it will still replicate to server because the part’s physics is controlled by the client
That’s how roblox’s physics work;
any part controlled by the client will be replicated to server (this is to reduce server load calculating physics)
:ApplyImpulse() from client, replicated to server automatically
so i have to use FireServer() in a localscript and put the ApplyImpulse in the server script?
Um, no
look at the previous reply
There’s an anti-fall bounce pad below in the image but it’s out of the picture
I used :FireClient() and let the character :ApplyImpulse() to itself from the client
also didn’t you already got it working? .-.
yes it works but i was wondering how to use it in a server script and if it even would work serversided in a localscript
part:SetNetworkOwner(nil)
part:ApplyImpulse(vector3.new(0, 1000, 0))
But you wouldn’t want to set network owner of your character to nil, (idk what will happen but most likely your character controls being unresponsive)
Yes, it will because a character part’s network ownership belongs to the client
therefore any physics calculation is handled by the client, and replicated to other clients internally through the physics engine
if i do SetNetworkOwner for a control player script would i be able to control the player
um no, why do you ask
:SetNetworkOwner(player or nil) only can be used on server (iirc)
:SetNetworkOwner() is a method of BasePart therefore will not work on objects of other classes, (script, for example)
it’s a method for deciding who to calculate the physics of said BasePart
set it to nil, the server calculates
set it to a player, the player calculates and send to server to replicate (internally)
please link me a guide of setnetworkowner