Hello Everyone! Dont flag this there isnt much to say about
Edit: I want paste my Gui in the LocalPlayer btw in the PlayerGui and seems like thats just possible with PlayerGUi
sword.Touched:Connect(function(hitted)
– if hitted ~= player.Character and not hitted:IsDescendantOf(player.character) then
local HumanoidRootPart = hitted.Parent:FindFirstChild(“HumanoidRootPart”)
local HumanoidNPC = hitted.Parent:FindFirstChild(“Humanoid”)
local plr = game.Players:GetPlayerFromCharacter(hitted.Parent)
Combat1:FireClient(plr)
**But how can I get the Local player ? I need to find the Localplayer. ** Because when I dont find this happen after I fireClient:
AND YES I TESTED ALSO WITH LOCALPLAYER STILL ERROR
if not plr:FindFirstChild("MenuGui") then
local AttackCollection2 = plr.PlayerGui.AttackCollection
AttackCollection2.Enabled = true
AttackCollection2.Parent = plr.LocalPlayer.PlayerGui
AttackCollection2.Enabled = true
end
BasePart.Touched:Connect(function(object)
local player = game:GetService("Players"):GetPlayerFromCharacter(object.Parent)
if player then
-- it's from a player, do stuff here
end
end)
Elaborate on what you want to accomplish. If you want to find the player that touched the part, then do what @HugeCoolboy2007 suggested. LocalPlayer only exists in LocalScripts and Modules required from a LocalScript
I am sorry but you just wrote what I did. Again, it will be a touched event, so we need from the touched event the Localplayer for copy my Gui in it. We dont want the player that is not touched. We just want the player that is touched, as you can see in my script.
script.Parent.Touched:Connect(function(hitted)
if hitted:FindFirstChild("Humanoid") then
local player = game.Players:FindFirstChild(hitted.Name)
--~~code here~~
end)
local player = game:GetService("Players").LocalPlayer
Combat1.OnClientEvent:Connect(function()
if not player:FindFirstChild("MenuGui") then
local AttackCollection2 = player.PlayerGui.AttackCollection
AttackCollection2.Enabled = true
end
end)
If you cant understand then you didnt understand the problem. again I want put the gui in the player that was touched. Touched, do you know? sword.Touched. If you still didnt understand I am sry