I'm familiar with using Remote Events and functions, but when I attempted this, it didn't work. Can someone correct where I went wrong?
Details:
A name GUI is obtained when a Part in a morph (hence, a roleplay game) is touched. The RemoteEvent in Workspace has the script that's supposed to allow you to change your name, and in the Part of the morph,the Server Script fires the event. In my case, something had gone wrong.
RemoteEvent in Workspace:
script.Parent.OnServerEvent:connect(function(player)
script.Parent.FocusLost:connect(function(enter)
if enter then
v = game.Players.LocalPlayer
for a, mod in pairs(v.Character:children()) do
if mod:findFirstChild("NameTag") then
v.Character.Head.Transparency = 0 mod:Destroy()
end
end
local char = v.Character
local mod = Instance.new("Model", char)
mod.Name = script.Parent.Text
local cl = char.Head:Clone()
cl.Parent = mod
local hum = Instance.new("Humanoid", mod)
hum.Name = "NameTag"
hum.MaxHealth = 0
hum.Health = 0
local weld = Instance.new("Weld", cl) weld.Part0 = cl weld.Part1 = char.Head
char.Head.Transparency = 1
end
end)
Server Script in GUI:
debounce = false
script.Parent.MouseButton1Down:connect(function()
if debounce == false then
debounce = true
game.Workspace.RPNameGUI:FireServer()
wait(3)
debounce = false
end
end)
|