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

Why my hat giver in GUI works only in local (only this player can see this hat)?

Asked by 4 years ago

Hello, I have script in GUI which giving hat but only person which clicks this button can see this hat. Also script is in local script.

this is this script

01local player = game:GetService("Players").LocalPlayer
02 
03script.Parent.MouseButton1Click:connect(function()
04    if player.Character:findFirstChild("Humanoid") ~= nil and player.Character:findFirstChild("Head6") == nil then
05        local g = game.ReplicatedStorage.Berets.ZANDARMERIA.Head6:clone()
06        g.Parent = player.Character
07        local C = g:GetChildren()
08        for i=1, #C do
09            if C[i].className == "Part" or C[i].className == "UnionOperation" then
10                local W = Instance.new("Weld")
11                W.Part0 = g.Middle
12                W.Part1 = C[i]
13                local CJ = CFrame.new(g.Middle.Position)
14                local C0 = g.Middle.CFrame:inverse()*CJ
15                local C1 = C[i].CFrame:inverse()*CJ
View all 35 lines...
0
You need to use remote events Leamir 3138 — 4y

1 answer

Log in to vote
2
Answered by 4 years ago

You need to use remote events to fire the server whenever the player equips a hat. Then in a sever script make it so that it puts the hat on the player from there instead of from your local script. This will allow all players to be able to see the hat.

0
To add on to this answer, the reason this needs to be done is FilteringEnabled - Roblox's protection against exploiters making any change they like to the game world. chess123mate 5873 — 4y
Ad

Answer this question