Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Filtering Enabled Welding script is not working in game but in studio?

Asked by 5 years ago
Edited 5 years ago

Problem

My script is, when the player joins it gets a part inside the workspace and welds it into the player. This works in studio but not in game. I've used FireClient so send code to Server to client but it doesn't work. What am I doing wrong?

LocalScript:

local Players = game:GetService('Players')
local Player = Players.LocalPlayer  
local char = Player.Character
local LeftArm = char.Torso

game.ReplicatedStorage.DoDun.OnClientEvent:Connect(function(Part)--Get the RemoteEvent
    print("hoolio")
     Part.CFrame = LeftArm.CFrame * CFrame.new(-5,0,0)
local weld = Instance.new("Weld")--Welds it to left arm -5 on the x scale
weld.Part0 = LeftArm
weld.C0 = LeftArm.CFrame:inverse()
weld.Part1 = Part
weld.C1 = Part.CFrame:inverse()
weld.Parent = Part
print("ok")
Part.Anchored = false
Part.CanCollide = false
print("non")
end)

Server Script

game.Players.PlayerAdded:Connect(function(Player)--Get the player when joines
        local Part = game.ReplicatedStorage.Part:Clone()--Clones the part 
        Part.Parent = workspace
   game.ReplicatedStorage.DoDun:FireClient(Player, Part)--FireClient with the RemoteEvent 
end)
1
Make the weld on the server xdeno 187 — 5y
0
That'll be client to server... mixgingengerina10 223 — 5y
0
Filtering Enabled basically means that the server will not trust anything the player does except movement. As you're attempting to make the changes from a local context the server doesn't trust it. I would advise you flip the scripts so that the welds are being made on the server instead, as for your code, it should work fine as soon as you make the weld on the server IllusionOfDreams14 -5 — 5y
1
I wish I could downvote comments. That is acceptable the weld would only show for the player... User#19524 175 — 5y

Answer this question