Only client that created the part can see it

I’m developing a game, which apparently was going well, until I decided to play with one of my friends, we decided to transform our character by adding parts to their bodies, that’s when only I could see changes in my avatar and only he could see the change itself .

the script is inserted in the starterCharacterScripts and is a localscript

the script adds ears and a tail

CAN YOU GUYS CHECK THE GAME?

Naruto Online MMORPG - Roblox!

Local scripts will only affect the client while server script affects everyone. You can either Server → Client about this change or Client → Server so every can see this change. If the information doesn’t pass through the server, other players will not see it.

1 Like

hm, ill check this.

so i think some ideas about:

the player fires an event and server replies it
server check player inputservice then it does

i am correct?

As, @Wizard101fire90 said, anything done in the client, would only show up for that specific client.

You would have to add the tails and ears from the server, by either welding them from a ServerScript (aka the normal script), no needt to use remote events.

1 Like

so this is the script:

local UserInputService = game:GetService("UserInputService")

--//Debounces

local punching = false

local ACTIVATED = false

local Player = game.Players.LocalPlayer

local Character = game.Workspace:WaitForChild(Player.Name)

local Humanoid = Character:FindFirstChild("Humanoid")

local Punch = Instance.new("Animation",script)

local chakra = game.ReplicatedStorage.Transform.Bijuu.BijuuChakra["8/9"].Chakra:Clone()

Punch.AnimationId = "rbxassetid://4755005087"

------------------------------------------------------------
local PunchTrack1 = Humanoid:LoadAnimation(Punch)

UserInputService.InputBegan:Connect(function(Input, IsTyping)
	if IsTyping then return end
	if Input.KeyCode == Enum.KeyCode.T and not punching then
		chakra.Parent = Character.Torso and Character.Head
		punching = true
        PunchTrack1:Play()
        wait(0.3)
        Character.HumanoidRootPart.Anchored = true
        wait(2.5)
        Character.HumanoidRootPart.Anchored = false
        Character.Humanoid.WalkSpeed = Character.Humanoid.WalkSpeed + 25
        Character.Humanoid.JumpPower = Character.Humanoid.JumpPower + 80
----------------------HAIR-----------------------------
        local Hair1 = game.ReplicatedStorage.Transform.Bijuu.BijuuParts.Kyuubi1.Handle:Clone()
        Hair1.Parent = Character
        Hair1.Name = "Hair"
        Hair1.CanCollide = false
        Hair1.Locked = true
        Hair1.CFrame = Character.Torso.CFrame
        local Weld = Instance.new("Weld")
        Weld.Parent = Character.Head
        Weld.Part0 = Character.Head
        Weld.Part1 = Hair1
        Weld.C0 = CFrame.new(0, 1.8, 0.11) * CFrame.Angles(0,math.pi,0)
       

	    elseif Input.KeyCode == Enum.KeyCode.T and punching==true and Humanoid.Parent:FindFirstChild("Hair")~=nil then
		chakra.Parent = nil
        Character.Humanoid.WalkSpeed = Character.Humanoid.WalkSpeed - 25	
        Character.Humanoid.JumpPower = Character.Humanoid.JumpPower - 80	
		
		        local Hair =Character:findFirstChild("Hair")
        if Hair~=nil then
	       Hair.Parent = nil
end

		
		wait(20)
		
		
        punching = false 








	end
end)

like player input service fire event then server weld a part on the player’s character

If this code is in a Local Script only you would be able to see the spawned in objects.

You need to use remote events and fire server and have a server script respond to the event by doing the actual spawning in

Edit:
You can test if what you see can be seen by others by switching your testing session to server with the computer button on the top left

1 Like

When in a LocalScript, only you yourself can see it. When in a regular Script, everyone else can see it. Hence the prefix “Local”, which I like to think of as “Near”, and my player is near the camera.

1 Like

So, this is the updated script:

local UserInputService = game:GetService("UserInputService")

--//Debounces

local punching = false

local ACTIVATED = false

local Player = game.Players.LocalPlayer

local Character = game.Workspace:WaitForChild(Player.Name)

local Humanoid = Character:FindFirstChild("Humanoid")

local Anim = Instance.new("Animation",script)

Anim.AnimationId = "rbxassetid://4755005087"





local Event = game.ReplicatedStorage.TransformEvent
--Event is a RemoteEvent



------------------------------------------------------------
local PunchTrack1 = Humanoid:LoadAnimation(Anim)

UserInputService.InputBegan:Connect(function(Input, IsTyping)
	if IsTyping then return end
	if Input.KeyCode == Enum.KeyCode.T and not punching then
		
		Event:FireServer()
		
		punching = true
        PunchTrack1:Play()
        wait(0.3)
        Character.HumanoidRootPart.Anchored = true
        wait(2.5)
        Character.HumanoidRootPart.Anchored = false
        Character.Humanoid.WalkSpeed = Character.Humanoid.WalkSpeed + 25
        Character.Humanoid.JumpPower = Character.Humanoid.JumpPower + 80    

	    elseif Input.KeyCode == Enum.KeyCode.T and punching==true and Humanoid.Parent:FindFirstChild("Hair")~=nil then
		
        Character.Humanoid.WalkSpeed = Character.Humanoid.WalkSpeed - 25	
        Character.Humanoid.JumpPower = Character.Humanoid.JumpPower - 80	

		wait(20)
		
        punching = false 
	end
end)

Not wrong, but it’s better to think of local as timid, something limited to a certain person, or certain area, or anything else.

4 Likes

It should work, but I dont know what the server script code is doing.

By the way the “Script” object is for server.

1 Like

serverscript:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage.TransformEvent

Event.Fired:Connect(function(plr)
	    local Character = plr.Character
	
	    local Hair1 = game.ReplicatedStorage.Transform.Bijuu.BijuuParts.Kyuubi1.Handle:Clone()
        Hair1.Parent = Character
        Hair1.Name = "Hair"
        Hair1.CanCollide = false
        Hair1.Locked = true
        Hair1.CFrame = Character.Torso.CFrame
        local Weld = Instance.new("Weld")
        Weld.Parent = Character.Head
        Weld.Part0 = Character.Head
        Weld.Part1 = Hair1
        Weld.C0 = CFrame.new(0, 1.8, 0.11) * CFrame.Angles(0,math.pi,0)
end)

.Fired is not a event of RemoteEvent

You should use OnServerEvent

2 Likes

did you saw the scripts i have replied here?

oh srry i didnt noticed that haha

1 Like

So is the code working now? What other issues are there, have you tested it?

IF there’s no more problems you can mark an answer in this thread as the solution.

1 Like

my computer are so slow, then i need to close chrome and wait studio loads the game…

so, not talking about the issue, whats the better button to transform on xbox?

Yes, as @HilyrHere said, .Fired isn’t a valid event for RemoteEvent. Try to regularly check Output and change .Fired to .OnServerEvent, which I believe triggers something when someone does a certain thing in the server.

1 Like

can you play the game to check if the script is working?