I suggest having every client handle everybody on their own, instead of having the server do it. This means you don’t need a remote event and you don’t need to tell everybody you jumped, since they can all tell for theirself.
uhhhhhhhhhhhh
Yeah! I totally understand.
Make every client detect their own and other people’s jumps, so they can do the jump effect. This means, the server doesn’t do the jump effect, but each client does instead.
yeah of course thats so easy comparing to you explaining it very clearly
So is it supposted to be LocalScript or Script…
You can just handle it on the Server when the Player joins, you would wait for the character to load and if they jump you would do the effect.
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function()
local humanoid = plr.Character:WaitForChild("Humanoid")
humanoid:GetPropertyChangedSignal("Jump"):Connect(function()
-- Do jump effect
end)
end)
end)
Where do I put this?
I’m still new to all this
ServerScriptService.
So do I copy this stuff under the condition to that new script?
Doesn’t work
17:35:36.839 HumanoidRootPart is not a valid member of DataModel “Game” - Server - JumpEffect:22
What? If it’s on the client, then yes it is a LocalScript. But more specifically, it’s on the client.
Something like this:
local function connectHumanoid(hum: Humanoid)
humanoid.StateChanged:Connect(function(oldState, newState)
if newState == Enum.HumanoidStateType.Jumping then
-- Jump effect here (NO REMOTE EVENT)
end
end)
end
--\\ Connections
local function onChar(char: Model)
if char then
connectHumanoid(char:WaitForChild("Humanoid"))
end
end
local function onPlayer(player: Player)
onChar(player.Character)
player.CharacterAdded:Connect(onChar)
end
for _, player in pairs(game.Players:GetPlayers()) do
onPlayer(player)
end
game.Players.PlayerAdded:Connect(onPlayer)
One should be able to figure out that, well, there’s a humanoid argument in the function, and that’s what I meant to use. Change humanoid
to hum
there, or change the argument name from hum
to humanoid
.
Going by the title, the script doesn’t work. Going by this reply, it had always worked. So which is it? Is it working, or not?
This basically fixed the script, but its teleporting the character TO the effect not to ME
But they kept insisting that they have to reparent everything and it made everything worse
Oh, I see. If you change the script to this, it should work.
Make sure to move the jump effect to replicatedstorage, and set it’s transparency to 1.
The issue is that you’re setting Part0 of the weld to the rootpart, and Part1 to the effect. This means, Part0 is welded to Part1, which you don’t want.
local function connectHumanoid(hum: Humanoid)
hum.StateChanged:Connect(function(_, new)
if new == Enum.HumanoidStateType.Jumping then
local jumpEffect = game.ReplicatedStorage.JumpEffect:Clone()
game.Debris:AddItem(jumpEffect,0.5)
local weld = Instance.new("Weld")
weld.Part0 = jumpEffect
weld.Part1 = hum.RootPart
weld.C0 = CFrame.new(0,-3.6,0) * CFrame.fromEulerAnglesXYZ(0,0,1.5)
weld.Parent = jumpEffect
jumpEffect.Parent = hum.Parent
jumpEffect.ParticleEmitter:Emit(45)
end
end)
end
--\\ Connections
local function onChar(char: Model)
if char then
connectHumanoid(char:WaitForChild("Humanoid"))
end
end
local function onPlayer(player: Player)
onChar(player.Character)
player.CharacterAdded:Connect(onChar)
end
for _, player in pairs(game.Players:GetPlayers()) do
onPlayer(player)
end
game.Players.PlayerAdded:Connect(onPlayer)
This is just one local script that you should place in PlayerGui, ScreenGui, or ReplicatedFirst.
Wait isn’t remoteservices supposted to be in Replicated Storage?
Remote events ideally should be in replicated storage, yes. But it isn’t using one in that script.
So basically I have to put the part in replicatedstorage?
The jumpeffect should be in ReplicatedStorage so the clients can access it, yes.