Hey, im working on an horror game, and i want to make so when you pick up something, it will pop up an text, i used events, but it dosen’t work, is there any issues?
Server Script:
script.Parent.Triggered:Connect(function(p)
local toolName = "Flaslight"
game.ReplicatedStorage.Flashlight:Clone().Parent = p.Backpack
game.ReplicatedStorage.PickupRe:FireClient(p, toolName)
end)
Local Script:
game.ReplicatedStorage.PickupRe.OnClientEvent:Connect(function(p, toolname)
local temp = game.ReplicatedStorage:WaitForChild("ActionText")
local text = temp:Clone()
local ts = game:GetService("TweenService")
local i = TweenInfo.new(3)
local i2 = TweenInfo.new(2)
local g = {Position = UDim2.new(.5, 0, -0.1, 0)}
local g2 = {TextTransparency = 1}
local t = ts:Create(text, i, g)
local t2 = ts:Create(text, i2, g2)
text.Parent = p.PlayerGui
text.Text = "+1 "..toolname
t:Play()
t2:Play()
t.Completed:Wait()
text:Destroy()
end)
Also, i have an console error:
Players.elepunto3993.PlayerGui.PickUpGui.LocalScript:12: attempt to concatenate string with nil
i dont know if the toolName variable is passing well?