Hey everyone!
I found a system where a circle closes in on the camera and I tried to make it so when a part is touched by the player but whenever I touch the part I get a lot of errors.
I’ve tried to fix this in a few ways but the errors always pop up.
This is my code.
local TweenService = game:GetService("TweenService")
local TweenTime = 1
local TweenIn = TweenService:Create(script.Parent, TweenInfo.new(TweenTime), {Size = UDim2.new(0, 0, 0, 0)})
local TweenOut = TweenService:Create(script.Parent, TweenInfo.new(TweenTime), {Size = UDim2.new(2, 0, 2, 0)})
script.Parent.Trigger.Event:Connect(function(delayTime)
script.Parent.Visible = true
script.Parent.Size = UDim2.new(2, 0, 2, 0)
TweenIn:Play()
wait(TweenTime + delayTime)
TweenOut:Play()
wait(TweenTime + delayTime)
script.Parent:WaitForChild("Trigger"):FireServer(delayTime)
end)
--TouchPart
local Brick = workspace:WaitForChild("OceanTele1")
local function PlayerTouched(Part)
local Parent = Part.Parent
if game.Players:GetPlayerFromCharacter(Parent) then
local plr = game.Players.LocalPlayer
game.Players.LocalPlayer.PlayerGui.Iris.Iris.Trigger:Fire(1)
wait(.7)
plr.Character.HumanoidRootPart.Position = Vector3.new(-100.364, 11, 126.212)
wait(.1)
plr.Character.HumanoidRootPart.Anchored = true
wait(1)
plr.Character.HumanoidRootPart.Anchored = false
end
end
Brick.Touched:connect(PlayerTouched)
If anyone has a solution please let me know.
Thanks!!!
You need to use a remote event, not a bindable event, to fire information to the server. It is very similar to a bindable event, but has differences: RemoteEvent | Documentation - Roblox Creator Hub
I see that you also used the :Fire() function in your script to send an event on the client. If this is necessary, you will need to create a bindable and remote event separately.