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

Why do my remote event tween scripts not work?

Asked by 4 years ago

I am trying to make a script that tweens a part when the player presses the R key. The problem is, it doesn't work. I tried to pinpoint whether the problem was in the tween script or the remote event script, but to no avail. There are also no errors when I run the game. I think that my problem might be related to the placement of the local script. I tried StarterPlayer and ReplicatedStorage but they did not work.

Tween event script:

local uis = game:GetService("UserInputService")
local repstorage = game:GetService("ReplicatedStorage")
local TweenEvent = repstorage:WaitForChild("TweenEvent")



uis.InputBegan:Connect(function(input, gameProcessedEvent)
    if input.KeyCode == Enum.KeyCode.R then
        TweenEvent:FireServer()
    end
end)

Tween script

local TweenService = game:GetService("TweenService")
local rs = game:GetService("ReplicatedStorage")
local TweenEvent = rs:WaitForChild("TweenEvent")

local part = Instance.new("Part")
part.Position = Vector3.new(0, 10, 0)
part.Color = Color3.new(1, 0, 0)
part.Anchored = true
part.Parent = game.Workspace
part.Size = Vector3.new(3, 3, 3)
part.Shape = "Ball"

local goal = {}
goal.Color = Color3.new(0, 1, 0)
goal.Size = Vector3.new(10, 10, 10)

local tweenInfo = TweenInfo.new(2,Enum.EasingStyle.Bounce,Enum.EasingDirection.In,0,true)

local tween = TweenService:Create(part, tweenInfo, goal)

TweenEvent.OnServerEvent:Connect(function(player)
    tween:Play()
end)
0
Forgot to mention that the RemoteEvent is in ReplicatedStorage. 2160grb 2 — 4y

Answer this question